Add package grid to profile page

This commit is contained in:
rubenwardy 2018-05-29 22:58:46 +01:00
parent 944b8a4eb0
commit edd51b86d0
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
2 changed files with 14 additions and 24 deletions

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

@ -65,26 +65,6 @@
</table>
</div>
<div class="box box_grey">
<h2>Packages</h2>
<div class="box-body">
<ul>
{% for p in packages %}
<li><a href="{{ p.getDetailsURL() }}">
{{ p.title }} by {{ p.author.display_name }}
</a></li>
{% else %}
<li><i>No packages available</i></ul>
{% endfor %}
</ul>
{% if user == current_user or user.checkPerm(current_user, "CHANGE_AUTHOR") %}
<p><a class="button" href="{{ url_for('create_edit_package_page', author=user.username) }}">
Create
</a></p>
{% endif %}
</div>
</div>
{% if form %}
{% from "macros/forms.html" import render_field, render_submit_field %}
<div class="box box_grey">
@ -114,4 +94,8 @@
</form>
</div>
{% endif %}
{% from "macros/packagegridtile.html" import render_pkggrid %}
{{ render_pkggrid(packages, show_author=False) }}
{% endblock %}