Move package grid to macro

This commit is contained in:
rubenwardy 2018-05-18 01:32:34 +01:00
parent 0b1aa8980b
commit 6711eb4afe
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
2 changed files with 25 additions and 17 deletions

@ -24,22 +24,7 @@ Dashboard
</header> </header>
<main> <main>
<ul class="packagegrid"> {% from "macros/packagegridtile.html" import render_pkggrid %}
{% for p in packages %} {{ render_pkggrid(packages) }}
<li><a href="{{ p.getDetailsURL() }}"
style="background-image: url({{ p.getMainScreenshotURL() or '/static/placeholder.png' }});">
<div class="packagegridscrub"></div>
<div class="packagegridinfo">
<h3>{{ p.title }} by {{ p.author.display_name }}</h3>
<p>
{{ p.shortDesc }}
</p>
</div>
</a></li>
{% else %}
<li><i>No packages available</i></ul>
{% endfor %}
</ul>
</main> </main>
{% endblock %} {% endblock %}

@ -0,0 +1,23 @@
{% macro render_pkgtile(package) -%}
<li><a href="{{ package.getDetailsURL() }}"
style="background-image: url({{ package.getMainScreenshotURL() or '/static/placeholder.png' }});">
<div class="packagegridscrub"></div>
<div class="packagegridinfo">
<h3>{{ package.title }} by {{ package.author.display_name }}</h3>
<p>
{{ package.shortDesc }}
</p>
</div>
</a></li>
{% endmacro %}
{% macro render_pkggrid(packages) -%}
<ul class="packagegrid">
{% for p in packages %}
{{ render_pkgtile(p) }}
{% else %}
<li><i>No packages available</i></ul>
{% endfor %}
</ul>
{% endmacro %}