citra-emu
/
citra-web
Archived
1
0
Fork 0

Implement alphabetical sorting

This commit is contained in:
James 2017-06-11 22:38:58 +10:00
parent bb2fe0be7c
commit f6d6e338d7
4 changed files with 66 additions and 26 deletions

View File

@ -123,6 +123,13 @@ function processGame(game) {
model.compatibility = recent.compatibility; model.compatibility = recent.compatibility;
model.testcase_date = recent.date; model.testcase_date = recent.date;
} }
let section_id = `${model.title[0]}`.toLowerCase();
if (!section_id.match(/[a-z]+/)) {
section_id = "#";
}
model.section_id = section_id;
// END SHORTCUTS BLOCK // END SHORTCUTS BLOCK
// SAVEFILE BLOCK // SAVEFILE BLOCK

View File

@ -14,6 +14,17 @@
<div id="highchart-container" style="height: 100px; margin: 0 auto"></div> <div id="highchart-container" style="height: 100px; margin: 0 auto"></div>
<hr />
<div id="game-sections">
<div class="btn-group" role="group">
<a class="btn btn-secondary" href="##">#</a>
{{ range (seq 'a' 'z') }}
<a class="btn btn-secondary" href="#{{ printf "%c" . }}">{{ printf "%c" . }}</a>
{{ end }}
</div>
</div>
<table class="table table-responsive"> <table class="table table-responsive">
<thead> <thead>
<tr> <tr>
@ -24,7 +35,14 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{ range .Data.Pages }} {{ range .Data.Pages.GroupByParam "section_id" }}
<tr>
<td id="game-section-header">
<h3 id="{{ .Key }}">{{ .Key }}</h3>
</td>
</tr>
{{ range .Pages }}
{{- $rating := index .Site.Data.compatibility .Params.compatibility }} {{- $rating := index .Site.Data.compatibility .Params.compatibility }}
<tr> <tr>
<td style="width: 55px;"><img class="img-responsive game-icon-list" src="{{ .Site.BaseURL }}images/game/icons/{{ default (print .File.BaseFileName ".png") }}" /></td> <td style="width: 55px;"><img class="img-responsive game-icon-list" src="{{ .Site.BaseURL }}images/game/icons/{{ default (print .File.BaseFileName ".png") }}" /></td>
@ -33,6 +51,7 @@
<td>{{ dateFormat "January 2, 2006" .Params.testcase_date }}</td> <td>{{ dateFormat "January 2, 2006" .Params.testcase_date }}</td>
</tr> </tr>
{{ end }} {{ end }}
{{ end }}
</tbody> </tbody>
</table> </table>
{{ end }} {{ end }}

View File

@ -5,7 +5,8 @@
{{- $gameIndex := $index }} {{- $gameIndex := $index }}
{{- $lenRegions := sub (len .Params.releases) 1 }} {{- $lenRegions := sub (len .Params.releases) 1 }}
{{- range $regionIndex, $element := .Params.releases }} {{- range $regionIndex, $element := .Params.releases }}
"{{ $element.title }}": { "region": "{{ .region }}", "gameID": "{{ $game.File.BaseFileName }}", "gameName": "{{ $game.Title | plainify }}" }{{- if and (eq $gameIndex $lenGames) (eq $regionIndex $lenRegions) }}{{ else }},{{ end }} "{{ $element.title }}": { "region": "{{ .region }}", "gameID": "{{ $game.File.BaseFileName }}",
"gameName": "{{ $game.Title | plainify }}" }{{- if and (eq $gameIndex $lenGames) (eq $regionIndex $lenRegions) }}{{ else }},{{ end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
} }

View File

@ -323,3 +323,16 @@ a:hover, a:focus {
/* Games Module */ /* Games Module */
.game-icon-list { } .game-icon-list { }
#game-sections {
display: table;
margin: 0 auto;
}
#game-sections .btn {
padding: 6px 10px;
}
#game-section-header {
border: 0;
}