Cleanup templates
This commit is contained in:
parent
b4a8ae73eb
commit
c50e11d0d5
6 changed files with 194 additions and 310 deletions
|
@ -14,43 +14,7 @@
|
|||
<body>
|
||||
<div class="Home">
|
||||
<div class="contentBox_">
|
||||
<div style="margin-bottom: 1rem;" class='searchBar'>
|
||||
<form action="/search" method="get">
|
||||
<div class="search_entry">
|
||||
<input style="width: 19rem;" type='text' id="q" name="q" value='' placeholder="Enter a level name or code"/>
|
||||
<button class="searchButton" id='searchButton' type='submit'>🔍</button>
|
||||
</div>
|
||||
<details>
|
||||
<summary>More options</summary>
|
||||
{% macro option(name, value, key) -%}
|
||||
<option value={{ value }} {{ isSelected(value, key) }}>{{ name }}</option>
|
||||
{%- endmacro %}
|
||||
<div class="sortType">
|
||||
<label for="sort">Sort type</label>
|
||||
<select id="sort" name="sort">
|
||||
{{ option("Rating", "average_rating", "sort") }}
|
||||
{{ option("Upload date", "created_at", "sort") }}
|
||||
{{ option("Difficulty", "average_difficulty", "sort") }}
|
||||
{{ option("Plays", "play_count", "sort") }}
|
||||
</select>
|
||||
<select id="dir" name="dir">
|
||||
{{ option("Descending", "desc", "dir") }}
|
||||
{{ option("Ascending", "asc", "dir") }}
|
||||
</select>
|
||||
</div>
|
||||
<div class="upload_date">
|
||||
<label for="date">Upload date</label>
|
||||
<select id="date" name="date">
|
||||
{{ option("All time", -1, "date") }}
|
||||
{{ option("Past 30 days", 720, "date") }}
|
||||
{{ option("Past 7 days", 168, "date") }}
|
||||
{{ option("Past day", 24, "date") }}
|
||||
{{ option("Past hour", 1, "date") }}
|
||||
</select>
|
||||
</div>
|
||||
</details>
|
||||
</form>
|
||||
</div>
|
||||
<span style="margin-bottom: 1em;">{% include "searchBar.html" %}</span>
|
||||
<div class="contentBox">
|
||||
<div class="header">IWM Browser</div>
|
||||
<div class="splitter"></div>
|
||||
|
|
38
iwm_browser/templates/levelCard.html
Normal file
38
iwm_browser/templates/levelCard.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
<div class="searchResultCard">
|
||||
<div class="thumbnail"><img aria-hidden="true" src="{{ generate_thumbnail_url(map['ID'], THUMB_URL) }}"></div>
|
||||
<div class="details">
|
||||
<div class="basic">
|
||||
<div class="levelTitle"><a href="/level/{{ map['ID'] }}">{{ map['Name'] }}</a></div>
|
||||
<div class="levelDifficulty"><span aria-label="Difficulty: {{ map['AverageUserDifficulty']|int }}">Difficulty: {{ '▲' * map['AverageUserDifficulty']|int }}</span></div>
|
||||
<div class="creatorName">by <a href="/user/{{ map['CreatorId'] }}"><b>{{ map['CreatorName'] }}</b></a></div>
|
||||
<div class="levelRating">{{ map['NumThumbsUp'] }} 👍 {{ map['NumThumbsDown'] }} 👎</div>
|
||||
<div class="replayVisibility">Replays visible: {{ "always" if map['ReplayVisibility'] == 2 }}{{ "after clear" if map['ReplayVisibility'] == 0 }}</div>
|
||||
<div class="dragonCoins">Gems : {{ map['DragonCoins'] }}</div>
|
||||
{% if map['Description'] != ''%}<div class="levelDescription">{{ map['Description'] }}</div>{% endif %}
|
||||
<div class="levelCode"><label for="levelCode-input-{{ map['ID'] }}">Code:</label> <input id="levelCode-input-{{ map['ID'] }}" type="text" onclick="copy(this)" readonly=1 value="{{ map['MapCode'] }}" /></div>
|
||||
<div class="fullResponse">
|
||||
<details>
|
||||
<summary>Full server response</summary>
|
||||
<table>
|
||||
<thead><td>Key</td><td>Value</td></thead>
|
||||
<tbody>
|
||||
{% for value in map %}
|
||||
<tr>
|
||||
<td>{{value}}</td><td>{{map[value]}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- <pre>{{ json_dumps(map, indent=4) }}</pre> -->
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
<div class="times">
|
||||
<div class="FirstClear">First Clear: <a href="/user/{{map['FirstClearUserID']}}"><b>{{ map['FirstClearUsername'] }}</b></a></div>
|
||||
{% set BestTime = convert_times(map['BestTimePlaytime']) %}
|
||||
{% set BestFullTime = convert_times(map['BestFullTimePlaytime']) %}
|
||||
<div class="BestTime">Best Time: <a href="/user/{{ map['BestFullTimeUserID'] }}"><b>{{ map['BestTimeUsername'] }}</b></a> [{{ BestTime[0] }}:{{ BestTime[1] }}:{{ BestTime[2] }}]</div>
|
||||
{% if map['BestFullTimeUserID'] != 0 %}<div class="BestTime {{ 'illegal' if not map['DragonCoins']}}">Best 100% Time: <a href="/user/{{map['BestFullTimeUserID']}}"><b>{{ map['BestFullTimeUsername'] }}</b></a> [{{ BestFullTime[0] }}:{{ BestFullTime[1] }}:{{ BestFullTime[2] }}]{{ "(illegal time)" if not map['DragonCoins'] }}</div>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -27,49 +27,7 @@
|
|||
<div class="header">Level</div>
|
||||
<div class="splitter"></div>
|
||||
<div class="searchResults">
|
||||
<div class="searchResultCard full">
|
||||
<div class="thumbnail"><img aria-hidden="true" src="{{ generate_thumbnail_url(map['ID'], THUMB_URL) }}"></div>
|
||||
<div class="details">
|
||||
<div class="basic">
|
||||
<div class="levelTitle"><a href="/level/{{ map['ID'] }}">{{ map['Name'] }}</a></div>
|
||||
<div class="levelDifficulty"><span aria-label="Difficulty: {{ map['AverageUserDifficulty']|int }}">Difficulty: {{ '▲' * map['AverageUserDifficulty']|int }}</span></div>
|
||||
<div class="creatorName">by <a href="/user/{{ map['CreatorId'] }}"><b>{{ map['CreatorName'] }}</b></a></div>
|
||||
<div class="levelRating">{{ map['NumThumbsUp'] }} 👍 {{ map['NumThumbsDown'] }} 👎</div>
|
||||
<div class="replayVisibility">Replays visible: {{ "always" if map['ReplayVisibility'] == 2 }}{{ "after clear" if map['ReplayVisibility'] == 0 }}</div>
|
||||
<div class="dragonCoins">Gems : {{ map['DragonCoins'] }}</div>
|
||||
{% if map['Description'] != ''%}<div class="levelDescription">{{ map['Description'] }}</div>{% endif %}
|
||||
<div class="levelCode"><label for="levelCode-input-{{ map['ID'] }}">Code:</label> <input id="levelCode-input-{{ map['ID'] }}" type="text" onclick="copy(this)" readonly=1 value="{{ map['MapCode'] }}" /></div>
|
||||
<div class="fullResponse">
|
||||
<details>
|
||||
<summary>Full server response</summary>
|
||||
<table>
|
||||
<thead><td>Key</td><td>Value</td></thead>
|
||||
<tbody>
|
||||
{% for value in map %}
|
||||
<tr>
|
||||
<td>{{value}}</td><td>{{map[value]}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- <pre>{{ json_dumps(map, indent=4) }}</pre> -->
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
<div class="times">
|
||||
<div class="FirstClear">First Clear: <a href="/user/{{map['FirstClearUserID']}}"><b>{{ map['FirstClearUsername'] }}</b></a></div>
|
||||
{% set BestTime = convert_times(map['BestTimePlaytime']) %}
|
||||
{% set BestFullTime = convert_times(map['BestFullTimePlaytime']) %}
|
||||
<div class="BestTime">Best Time: <a href="/user/{{ map['BestFullTimeUserID'] }}"><b>{{ map['BestTimeUsername'] }}</b></a> [{{ BestTime[0] }}:{{ BestTime[1] }}:{{ BestTime[2] }}]</div>
|
||||
{% if map['BestFullTimeUserID'] != 0 %}<div class="BestTime {{ 'illegal' if not map['DragonCoins']}}">Best 100% Time: <a href="/user/{{map['BestFullTimeUserID']}}"><b>{{ map['BestFullTimeUsername'] }}</b></a> [{{ BestFullTime[0] }}:{{ BestFullTime[1] }}:{{ BestFullTime[2] }}]{{ "(illegal time)" if not map['DragonCoins'] }}</div>{% endif %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% include 'levelCard.html' %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -35,51 +35,10 @@
|
|||
{% if response.Maps %}
|
||||
<div class="searchResults">
|
||||
{% for map in response.Maps %}
|
||||
<div class="searchResultCard">
|
||||
<div class="thumbnail"><img aria-hidden="true" src="{{ generate_thumbnail_url(map['ID'], THUMB_URL) }}"></div>
|
||||
<div class="details">
|
||||
<div class="basic">
|
||||
<div class="levelTitle"><a href="/level/{{ map['ID'] }}">{{ map['Name'] }}</a></div>
|
||||
<div class="levelDifficulty"><span aria-label="Difficulty: {{ map['AverageUserDifficulty']|int }}">Difficulty: {{ '▲' * map['AverageUserDifficulty']|int }}</span></div>
|
||||
<div class="creatorName">by <a href="/user/{{ map['CreatorId'] }}"><b>{{ map['CreatorName'] }}</b></a></div>
|
||||
<div class="levelRating">{{ map['NumThumbsUp'] }} 👍 {{ map['NumThumbsDown'] }} 👎</div>
|
||||
<div class="replayVisibility">Replays visible: {{ "always" if map['ReplayVisibility'] == 2 }}{{ "after clear" if map['ReplayVisibility'] == 0 }}</div>
|
||||
<div class="dragonCoins">Gems : {{ map['DragonCoins'] }}</div>
|
||||
{% if map['Description'] != ''%}<div class="levelDescription">{{ map['Description'] }}</div>{% endif %}
|
||||
<div class="levelCode"><label for="levelCode-input-{{ map['ID'] }}">Code:</label> <input id="levelCode-input-{{ map['ID'] }}" type="text" onclick="copy(this)" readonly=1 value="{{ map['MapCode'] }}" /></div>
|
||||
<div class="fullResponse">
|
||||
<details>
|
||||
<summary>Full server response</summary>
|
||||
<table>
|
||||
<thead><td>Key</td><td>Value</td></thead>
|
||||
<tbody>
|
||||
{% for value in map %}
|
||||
<tr>
|
||||
<td>{{value}}</td><td>{{map[value]}}</td>
|
||||
</tr>
|
||||
{% include 'levelCard.html' %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- <pre>{{ json_dumps(map, indent=4) }}</pre> -->
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
<div class="times">
|
||||
<div class="FirstClear">First Clear: <a href="/user/{{map['FirstClearUserID']}}"><b>{{ map['FirstClearUsername'] }}</b></a></div>
|
||||
{% set BestTime = convert_times(map['BestTimePlaytime']) %}
|
||||
{% set BestFullTime = convert_times(map['BestFullTimePlaytime']) %}
|
||||
<div class="BestTime">Best Time: <a href="/user/{{ map['BestFullTimeUserID'] }}"><b>{{ map['BestTimeUsername'] }}</b></a> [{{ BestTime[0] }}:{{ BestTime[1] }}:{{ BestTime[2] }}]</div>
|
||||
{% if map['BestFullTimeUserID'] != 0 %}<div class="BestTime {{ 'illegal' if not map['DragonCoins']}}">Best 100% Time: <a href="/user/{{map['BestFullTimeUserID']}}"><b>{{ map['BestFullTimeUsername'] }}</b></a> [{{ BestFullTime[0] }}:{{ BestFullTime[1] }}:{{ BestFullTime[2] }}]{{ "(illegal time)" if not map['DragonCoins'] }}</div>{% endif %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -28,85 +28,11 @@
|
|||
<div class="contentBox_">
|
||||
<div class="header">Search</div>
|
||||
<div class="splitter"></div>
|
||||
<div class='searchBar'>
|
||||
<form action="/search" method="get">
|
||||
<div class="search_entry">
|
||||
<input type='text' id="q" name="q" value='{{ QueryValues["q"] if QueryValues["q"] is not none }}' placeholder="Enter a level name or code"/>
|
||||
<button class="searchButton" id='searchButton' type='submit'>🔍</button>
|
||||
</div>
|
||||
<details>
|
||||
<summary>More options</summary>
|
||||
{% macro option(name, value, key) -%}
|
||||
<option value={{ value }} {{ isSelected(value, QueryValues[key]) }}>{{ name }}</option>
|
||||
{%- endmacro %}
|
||||
<div class="sortType">
|
||||
<label for="sort">Sort type</label>
|
||||
<select id="sort" name="sort">
|
||||
{{ option("Rating", "average_rating", "sort") }}
|
||||
{{ option("Upload date", "created_at", "sort") }}
|
||||
{{ option("Difficulty", "average_difficulty", "sort") }}
|
||||
{{ option("Plays", "play_count", "sort") }}
|
||||
</select>
|
||||
<select id="dir" name="dir">
|
||||
{{ option("Descending", "desc", "dir") }}
|
||||
{{ option("Ascending", "asc", "dir") }}
|
||||
</select>
|
||||
</div>
|
||||
<div class="upload_date">
|
||||
<label for="date">Upload date</label>
|
||||
<select id="date" name="date">
|
||||
{{ option("All time", -1, "date") }}
|
||||
{{ option("Past 30 days", 720, "date") }}
|
||||
{{ option("Past 7 days", 168, "date") }}
|
||||
{{ option("Past day", 24, "date") }}
|
||||
{{ option("Past hour", 1, "date") }}
|
||||
</select>
|
||||
</div>
|
||||
</details>
|
||||
</form>
|
||||
</div>
|
||||
{% include "searchBar.html" %}
|
||||
{% if searchResults %}
|
||||
<div class="searchResults">
|
||||
{% for map in searchResults %}
|
||||
<div class="searchResultCard">
|
||||
<div class="thumbnail"><img aria-hidden="true" src="{{ generate_thumbnail_url(map['ID'], THUMB_URL) }}"></div>
|
||||
<div class="details">
|
||||
<div class="basic">
|
||||
<div class="levelTitle"><a href="/level/{{ map['ID'] }}">{{ map['Name'] }}</a></div>
|
||||
<div class="levelDifficulty"><span aria-label="Difficulty: {{ map['AverageUserDifficulty']|int }}">Difficulty: {{ '▲' * map['AverageUserDifficulty']|int }}</span></div>
|
||||
<div class="creatorName">by <a href="/user/{{ map['CreatorId'] }}"><b>{{ map['CreatorName'] }}</b></a></div>
|
||||
<div class="levelRating">{{ map['NumThumbsUp'] }} 👍 {{ map['NumThumbsDown'] }} 👎</div>
|
||||
<div class="replayVisibility">Replays visible: {{ "always" if map['ReplayVisibility'] == 2 }}{{ "after clear" if map['ReplayVisibility'] == 0 }}</div>
|
||||
<div class="dragonCoins">Gems : {{ map['DragonCoins'] }}</div>
|
||||
{% if map['Description'] != ''%}<div class="levelDescription">{{ map['Description'] }}</div>{% endif %}
|
||||
<div class="levelCode"><label for="levelCode-input-{{ map['ID'] }}">Code:</label> <input id="levelCode-input-{{ map['ID'] }}" type="text" onclick="copy(this)" readonly=1 value="{{ map['MapCode'] }}" /></div>
|
||||
<div class="fullResponse">
|
||||
<details>
|
||||
<summary>Full server response</summary>
|
||||
<table>
|
||||
<thead><td>Key</td><td>Value</td></thead>
|
||||
<tbody>
|
||||
{% for value in map %}
|
||||
<tr>
|
||||
<td>{{value}}</td><td>{{map[value]}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- <pre>{{ json_dumps(map, indent=4) }}</pre> -->
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
<div class="times">
|
||||
<div class="FirstClear">First Clear: <a href="/user/{{map['FirstClearUserID']}}"><b>{{ map['FirstClearUsername'] }}</b></a></div>
|
||||
{% set BestTime = convert_times(map['BestTimePlaytime']) %}
|
||||
{% set BestFullTime = convert_times(map['BestFullTimePlaytime']) %}
|
||||
<div class="BestTime">Best Time: <a href="/user/{{ map['BestFullTimeUserID'] }}"><b>{{ map['BestTimeUsername'] }}</b></a> [{{ BestTime[0] }}:{{ BestTime[1] }}:{{ BestTime[2] }}]</div>
|
||||
{% if map['BestFullTimeUserID'] != 0 %}<div class="BestTime {{ 'illegal' if not map['DragonCoins']}}">Best 100% Time: <a href="/user/{{map['BestFullTimeUserID']}}"><b>{{ map['BestFullTimeUsername'] }}</b></a> [{{ BestFullTime[0] }}:{{ BestFullTime[1] }}:{{ BestFullTime[2] }}]{{ "(illegal time)" if not map['DragonCoins'] }}</div>{% endif %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% include "levelCard.html" %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
|
|
39
iwm_browser/templates/searchBar.html
Normal file
39
iwm_browser/templates/searchBar.html
Normal file
|
@ -0,0 +1,39 @@
|
|||
<div class='searchBar'>
|
||||
<form action="/search" method="get">
|
||||
<div class="search_entry">
|
||||
{% set QueryValues = "" if not QueryValues %}
|
||||
<input type='text' id="q" name="q" value='{{ QueryValues["q"] if QueryValues["q"] is not none }}' placeholder="Enter a level name or code"/>
|
||||
<button class="searchButton" id='searchButton' type='submit'>🔍</button>
|
||||
</div>
|
||||
<details>
|
||||
<summary>More options</summary>
|
||||
{% macro option(name, value, key) -%}
|
||||
<option value={{ value }} {{ isSelected(value, QueryValues[key]) }}>{{ name }}</option>
|
||||
{%- endmacro %}
|
||||
<div class="sortType">
|
||||
<label for="sort">Sort type</label>
|
||||
<select id="sort" name="sort">
|
||||
{{ option("Rating", "average_rating", "sort") }}
|
||||
{{ option("Upload date", "created_at", "sort") }}
|
||||
{{ option("Difficulty", "average_difficulty", "sort") }}
|
||||
{{ option("Plays", "play_count", "sort") }}
|
||||
</select>
|
||||
<select id="dir" name="dir">
|
||||
{{ option("Descending", "desc", "dir") }}
|
||||
{{ option("Ascending", "asc", "dir") }}
|
||||
</select>
|
||||
</div>
|
||||
<div class="upload_date">
|
||||
<label for="date">Upload date</label>
|
||||
<select id="date" name="date">
|
||||
{{ option("All time", -1, "date") }}
|
||||
{{ option("Past 30 days", 720, "date") }}
|
||||
{{ option("Past 7 days", 168, "date") }}
|
||||
{{ option("Past day", 24, "date") }}
|
||||
{{ option("Past hour", 1, "date") }}
|
||||
</select>
|
||||
</div>
|
||||
</details>
|
||||
</form>
|
||||
</div>
|
||||
|
Loading…
Reference in a new issue