mirror of
https://github.com/yuzu-emu/shared-bulma-theme.git
synced 2024-11-24 03:05:38 +01:00
Updated listing to support a large amount of entries. Use the default boxart if none exists.
This commit is contained in:
parent
006f27cf71
commit
dcafd64efe
@ -28,130 +28,34 @@
|
||||
<table class="table is-fullwidth">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Game Title</th>
|
||||
<th>Compatibility</th>
|
||||
<th>Date Tested</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range .Data.Pages.GroupByParam "section_id" }}
|
||||
<tbody class="is-size-7">
|
||||
{{ range .Pages }}
|
||||
{{ $rating := index .Site.Data.compatibility .Params.compatibility }}
|
||||
{{ $type := index .Site.Data.gameTypes (.Params.game_type | default "3ds") }}
|
||||
<tr data-key="{{ .Params.section_id }}">
|
||||
<td class="is-hidden listing-metadata">
|
||||
<span>{{ .Params.title }} {{ $type.name }} {{ $rating.name }} {{ dateFormat "January 2, 2006" .Params.testcase_date }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<img src="{{ .Site.BaseURL }}/images/game/icons/{{ .File.BaseFileName }}.png" style="width: 48px; height: 48px;" />
|
||||
</td>
|
||||
<td data-title="{{ strings.TrimPrefix "The " .Params.title }}">
|
||||
<td data-title="{{ .Params.title }}">
|
||||
<a href="{{ .Permalink }}">{{ .Params.title }}</a>
|
||||
</td>
|
||||
<td data-compatibility="{{ $rating.key }}">
|
||||
<div class="is-square" style="background-color: {{ $rating.color }}"></div> <span>{{ $rating.name }}</span>
|
||||
</td>
|
||||
<td data-timestamp="{{ .Params.testcase_date }}">
|
||||
<span>{{ dateFormat "January 2, 2006" .Params.testcase_date }}</span>
|
||||
{{ if .Params.testcase_date }}
|
||||
<span>{{ dateFormat "January 2, 2006" .Params.testcase_date }}</span>
|
||||
{{ else }}
|
||||
<span></span>
|
||||
{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "scripts" }}
|
||||
<!-- <script type="text/javascript">
|
||||
$(function() {
|
||||
function getLastSorted(list){
|
||||
var currentSorted = $(list.listContainer).find(".asc, .desc").attr("data-sort");
|
||||
if ('undefined' !== typeof currentSorted)
|
||||
list.lastSorted = currentSorted;
|
||||
return list.lastSorted;
|
||||
}
|
||||
|
||||
function filterTable(_) {
|
||||
var rating = this.name;
|
||||
var index = this.index;
|
||||
|
||||
$("#search-box").val(rating);
|
||||
list.search(index, ['compatibility']);
|
||||
}
|
||||
|
||||
function clearSearch() {
|
||||
$("#search-box").val("");
|
||||
list.search();
|
||||
}
|
||||
|
||||
var options = {
|
||||
valueNames: [
|
||||
'listing-metadata',
|
||||
{ name: 'title', attr: 'data-title' },
|
||||
{ name: 'type', attr: 'data-type' },
|
||||
{ name: 'compatibility', attr: 'data-compatibility' },
|
||||
{ name: 'date-tested', attr: 'data-timestamp' }
|
||||
],
|
||||
searchColumns: [ 'listing-metadata' ],
|
||||
pagination: [
|
||||
{ paginationClass: "paginationTop" },
|
||||
{ paginationClass: "paginationBottom" }
|
||||
],
|
||||
indexAsync: true,
|
||||
page: 50
|
||||
};
|
||||
|
||||
var list = new List('game-listing', options);
|
||||
|
||||
list.sort("title", {order: "asc"});
|
||||
|
||||
list.on("updated", function(list){
|
||||
var $list = $(list.list);
|
||||
var $items = $list.children();
|
||||
$items.removeClass("key");
|
||||
if ('title' == getLastSorted(list)){
|
||||
$items.each(function(){
|
||||
var key = $(this).attr("data-key")
|
||||
if (
|
||||
$list
|
||||
.children("[data-key='" + key + "']")
|
||||
.first()
|
||||
.is( $(this) )
|
||||
){
|
||||
$(this).addClass("key");
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
$('#game-listing .clear-search').click(clearSearch);
|
||||
|
||||
Highcharts.chart('highchart-container', {
|
||||
chart: { type: 'bar' },
|
||||
colors: [{{ range .Site.Data.compatibility }}"{{ .color }}", {{- end }}],
|
||||
credits: { enabled: false },
|
||||
exporting: { enabled: false },
|
||||
title: { text: '' },
|
||||
xAxis: { categories: [''] },
|
||||
yAxis: { min: 0, max: {{ len .Data.Pages }}, title: { text: '' } },
|
||||
legend: { enabled: false },
|
||||
plotOptions: { series: {
|
||||
stacking: 'normal',
|
||||
cursor: 'pointer',
|
||||
events: {
|
||||
click: filterTable
|
||||
}
|
||||
} },
|
||||
series: [
|
||||
{{- $dataPages := .Data.Pages }}
|
||||
{{- range .Site.Data.compatibility }}
|
||||
{{- $dataPagesFiltered := where $dataPages ".Params.compatibility" .key }}
|
||||
{ "name": "{{ .name }}", "data": [ {{ len $dataPagesFiltered }} ] },
|
||||
{{- end }}
|
||||
]
|
||||
});
|
||||
});
|
||||
</script> -->
|
||||
{{ end }}
|
||||
|
@ -3,7 +3,11 @@
|
||||
{{ $rating := index .Site.Data.compatibility .Params.compatibility }}
|
||||
<section class="section content pt-sm">
|
||||
<div class="has-text-centered py-md">
|
||||
<img src="{{ .Site.BaseURL }}/images/game/boxart/{{ .Params.Banner | default (print .File.BaseFileName ".png") }}" />
|
||||
{{ if (fileExists (print "static/images/game/boxart/" .File.BaseFileName ".png")) }}
|
||||
<img src="{{ .Site.BaseURL }}/images/game/boxart/{{ .File.BaseFileName }}.png" />
|
||||
{{ else }}
|
||||
<img src="{{ .Site.BaseURL }}/images/game/boxart/_default.png" />
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="columns is-mobile">
|
||||
@ -19,7 +23,7 @@
|
||||
<div class="column">
|
||||
{{ range .Params.releases }}
|
||||
<div>
|
||||
<div><img src="{{ .Site.BaseURL }}/images/regions/{{ .region }}.png" /> {{ .id }}</div>
|
||||
<div><img src="{{ .Site.BaseURL }}/images/regions/{{ .region | default "all" }}.png" /> {{ .id }}</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user