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

Changed compatibility to be a string to avoid confusion between the string value and integer index.

This commit is contained in:
chris062689 2017-06-06 16:11:29 -04:00
parent a2ae816ce5
commit 3354212649
5 changed files with 25 additions and 24 deletions

View File

@ -145,10 +145,10 @@ try {
// Parse testcase information out of the dat to reinject as shortcut values. // Parse testcase information out of the dat to reinject as shortcut values.
var dat = toml.parse(datContents); var dat = toml.parse(datContents);
if (dat.testcases == null || dat.testcases.length == 0) { if (dat.testcases == null || dat.testcases.length == 0) {
datContents = `compatibility = 99"\r\ntestcase_date = "2000-01-01"\r\n` + datContents; datContents = `compatibility = \"99\"\r\ntestcase_date = "2000-01-01"\r\n` + datContents;
} else { } else {
let recent = dat.testcases[0]; let recent = dat.testcases[0];
datContents = `compatibility = ${recent.compatibility}\r\ntestcase_date = "${recent.date}"\r\n` + datContents; datContents = `compatibility = \"${recent.compatibility}\"\r\ntestcase_date = "${recent.date}"\r\n` + datContents;
} }
var wikiContents = ""; var wikiContents = "";

View File

@ -1,9 +1,9 @@
{ {
"0": { "name": "Perfect", "color": "#5c93ed", "description": "Game functions flawless with no audio or graphical glitches, all tested functionality works as intended without any workarounds needed." }, "0": { "key": "0", "name": "Perfect", "color": "#5c93ed", "description": "Game functions flawless with no audio or graphical glitches, all tested functionality works as intended without any workarounds needed." },
"1": { "name": "Great", "color": "#47d35c", "description": "Game functions with minor graphical or audio glitches and is playable from start to finish. May require some workarounds." }, "1": { "key": "1", "name": "Great", "color": "#47d35c", "description": "Game functions with minor graphical or audio glitches and is playable from start to finish. May require some workarounds." },
"2": { "name": "Okay", "color": "#94b242", "description": "Game functions with major graphical or audio glitches, but game is playable from start to finish with workarounds." }, "2": { "key": "2", "name": "Okay", "color": "#94b242", "description": "Game functions with major graphical or audio glitches, but game is playable from start to finish with workarounds." },
"3": { "name": "Bad", "color": "#f2d624", "description": "Game functions, but with major graphical or audio glitches. Unable to progress in specific areas due to glitches even with workarounds." }, "3": { "key": "3", "name": "Bad", "color": "#f2d624", "description": "Game functions, but with major graphical or audio glitches. Unable to progress in specific areas due to glitches even with workarounds." },
"4": { "name": "Intro/Menu", "color": "red", "description": "Game is completely unplayable due to major graphical or audio glitches. Unable to progress past the Start Screen." }, "4": { "key": "4", "name": "Intro/Menu", "color": "red", "description": "Game is completely unplayable due to major graphical or audio glitches. Unable to progress past the Start Screen." },
"5": { "name": "Won't Boot", "color": "#828282", "description": "The game crashes when attempting to startup." }, "5": { "key": "5", "name": "Won't Boot", "color": "#828282", "description": "The game crashes when attempting to startup." },
"99": { "name": "Not Tested", "color": "black", "description": "This game has not yet been tested." } "99": { "key": "99", "name": "Not Tested", "color": "black", "description": "The game has not yet been tested." }
} }

View File

@ -5,8 +5,8 @@
<tbody> <tbody>
{{ range .Site.Data.compatibility }} {{ range .Site.Data.compatibility }}
<tr> <tr>
<td style="width: 128px;"><div class="square-icon" style="background-color: {{ .color }}"></div> {{ .name }}</td> <td style="width: 120px;"><div class="square-icon" style="background-color: {{ .color }}"></div> {{ .name }}</td>
<td>{{ .description }}</td> <td class="row-compat-desc">{{ .description }}</td>
</tr> </tr>
{{ end }} {{ end }}
</tbody> </tbody>
@ -25,11 +25,11 @@
</thead> </thead>
<tbody> <tbody>
{{ range .Data.Pages }} {{ range .Data.Pages }}
{{- $rating := index .Site.Data.compatibility ( string .Params.compatibility | default "99" ) }} {{- $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>
<td><a href="{{ .Permalink }}">{{ .Params.title }}</a></td> <td><a href="{{ .Permalink }}">{{ .Params.title }}</a></td>
<td class="compatibility-row"><div class="square-icon compatibility-{{ replace ($rating.name | urlize) "/" "" }}" style="background-color: {{ $rating.color }}"></div> {{ $rating.name }}</td> <td class="compatibility-row"><div class="square-icon" style="background-color: {{ $rating.color }}"></div> {{ $rating.name }}</td>
<td>{{ dateFormat "January 2, 2006" .Params.testcase_date }}</td> <td>{{ dateFormat "January 2, 2006" .Params.testcase_date }}</td>
</tr> </tr>
{{ end }} {{ end }}
@ -49,13 +49,15 @@ Highcharts.chart('highchart-container', {
exporting: { enabled: false }, exporting: { enabled: false },
title: { text: '' }, title: { text: '' },
xAxis: { categories: [''] }, xAxis: { categories: [''] },
yAxis: { min: 0, max: $(".compatibility-row").length, title: { text: '' } }, yAxis: { min: 0, max: {{ len .Data.Pages }}, title: { text: '' } },
legend: { enabled: false }, legend: { enabled: false },
plotOptions: { series: { stacking: 'normal' } }, plotOptions: { series: { stacking: 'normal' } },
series: [ series: [
{{ range .Site.Data.compatibility }} {{- $dataPages := .Data.Pages }}
{ "name": "{{ .name }}", "data": [$(".compatibility-{{ replace (.name | urlize) "/" "" }}").length] }, {{- range .Site.Data.compatibility }}
{{ end }} {{- $dataPagesFiltered := where $dataPages ".Params.compatibility" .key }}
{ "name": "{{ .name }}", "data": [ {{ len $dataPagesFiltered }} ] },
{{- end }}
] ]
}); });
</script> </script>

View File

@ -1,4 +1,4 @@
{{- $rating := index .Site.Data.compatibility ( string .Params.compatibility | default "99" ) }} {{- $rating := index .Site.Data.compatibility .Params.compatibility }}
<meta property="og:description" content="{{ $rating.name }} - {{ $rating.description }}" /> <meta property="og:description" content="{{ $rating.name }} - {{ $rating.description }}" />
<meta name="description" content="{{ $rating.name }} - {{ $rating.description }}" /> <meta name="description" content="{{ $rating.name }} - {{ $rating.description }}" />

View File

@ -35,7 +35,7 @@
<table class="table table-responsive table-striped table-bordered"> <table class="table table-responsive table-striped table-bordered">
<tbody> <tbody>
<tr> <tr>
{{- $rating := index .Site.Data.compatibility ( string .Params.compatibility | default "99" ) }} {{- $rating := index .Site.Data.compatibility .Params.compatibility }}
<td style="width: 100px;">Status</td> <td style="width: 100px;">Status</td>
<td><b><div class="square-icon" style="background-color: {{ $rating.color }}"></div> {{ $rating.name }}</b><br />{{ $rating.description }}</td> <td><b><div class="square-icon" style="background-color: {{ $rating.color }}"></div> {{ $rating.name }}</b><br />{{ $rating.description }}</td>
</tr> </tr>
@ -72,8 +72,7 @@
{{ if isset .Params "testcases" }} {{ if isset .Params "testcases" }}
{{ $siteCompatibility := .Site.Data.compatibility }} {{ $siteCompatibility := .Site.Data.compatibility }}
{{ range .Params.testcases }} {{ range .Params.testcases }}
{{ $testcase := . }} {{- $rating := index $siteCompatibility .compatibility }}
{{ $rating := index $siteCompatibility ( string $testcase.compatibility | default "0" ) }}
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h2>Compatibility</h2> <h2>Compatibility</h2>
@ -88,9 +87,9 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>{{ dateFormat "January 2, 2006" $testcase.date }}</td> <td>{{ dateFormat "January 2, 2006" .date }}</td>
<td><a href="https://community.citra-emu.org/u/{{ $testcase.owner }}/summary">{{ $testcase.author }}</a></td> <td><a href="https://community.citra-emu.org/u/{{ .owner }}/summary">{{ .author }}</a></td>
<td>{{ $testcase.version }}</td> <td>{{ .version }}</td>
<td><b><div class="square-icon" style="background-color: {{ $rating.color }}"></div> {{ $rating.name }}</b></td> <td><b><div class="square-icon" style="background-color: {{ $rating.color }}"></div> {{ $rating.name }}</b></td>
</tr> </tr>
</tbody> </tbody>