Skip to content

Commit

Permalink
Extracted template logic into more templates
Browse files Browse the repository at this point in the history
  • Loading branch information
siznax committed Feb 26, 2021
1 parent 85b300e commit f8483b2
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Moo/play/templates/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% extends "layout.html" %}

{% block body %}

<div style="text-align: center;">
<div
class="bg-1 clr-5"
style="margin: 32px;
padding: 32px;
font-size: 24px;
border-radius: 8px;
width: 420px;
margin-left: auto;
margin-right: auto;">
<span style="margin-right: 0.5em;">
{{ emoji.notfound | safe }}
</span>
404 Page Not Found
</div>
</div>

{% endblock %}
20 changes: 20 additions & 0 deletions Moo/play/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% extends "layout.html" %}

{% block body %}

<h1><a href="/">{{ emoji.app | safe }}</a> {{ base }}</h1>

<p>
<span class="box">
{{ "{:,}".format(albums | length) }} albums</span>
</p>

<blockquote style="width: 65%; margin-left: auto; margin-right: auto;">
<ol style="text-align: left">
{% for path in albums %}
<li><a href="file://{{ path }}">{{ path }}</a></li>
{% endfor %}
</ol>
</blockquote>

{% endblock %}
17 changes: 17 additions & 0 deletions Moo/play/templates/clock.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div style="position: fixed; top: 8px; right: 12px;">
<span
id="time"
class="clr-5"></span>
{%-
if request.path.startswith('/album')
or request.path.startswith('/track')
or request.path.startswith('/docs')
-%}
<a href="/"
class="button"
style="margin-left: 8px">&times;</a>
{% else %}
<a href="/random"
style="margin-left: 8px;">{{ emoji.random | safe }}</a>
{%- endif -%}
</div>
27 changes: 27 additions & 0 deletions Moo/play/templates/counter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<div id="{{ counter }}-counts" style="display: none">

<p>
<div style="margin-bottom: 1em">
<span class="box">
{{ "{:,}".format(counts[counter] | length) }}
<b>{{ counter }}s</b></span>
</div>

{% for item in counts[counter] | sort %}

<div class="box count-card">

<span class="clr-5" style="float: right">
{{ counts[counter][item] }}</span>

<div style="max-width: 180px;">
<a href="/{{ counter }}/{{ item | urlencode }}">
{{ item }}</a>
</div>

</div>

{% endfor %}
</p>

</div>
5 changes: 5 additions & 0 deletions Moo/play/templates/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<p id="footer"
class="center">
<a href="{{ config.WWW }}">moo</a>
{{ config.VERSION }}
</p>
6 changes: 6 additions & 0 deletions Moo/play/templates/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div id="header">
{% include "facet-buttons.html" %}
{% include "genre-buttons.html" %}
{% include "alpha-buttons.html" %}
{% include "emoji-buttons.html" %}
</div>
18 changes: 18 additions & 0 deletions Moo/play/templates/prefixed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% if prefixed %}
<div
style="margin-bottom: 1.2em;
padding: 0.1em 0;
background-color: yellow;
border-radius: 8px;">

{% for prefix in prefixed %}
<ul>
<span>{{ prefix }}</span>
{% for item in prefixed[prefix] %}
<li>{{ item }}</li>
{% endfor %}
</ul>
{% endfor %}

</div>
{% endif %}

0 comments on commit f8483b2

Please sign in to comment.