contentdb/app/templates/macros/packagegridtile.html
2023-08-14 18:55:42 +01:00

49 lines
1.5 KiB
HTML

{% macro render_pkgtile(package, show_author) -%}
<li class="packagetile flex-fill"><a href="{{ package.get_url('packages.view') }}"
style="background-image: url({{ package.get_thumb_or_placeholder(2) }});">
<div class="packagegridscrub"></div>
<div class="packagegridinfo">
<h3>
{{ package.title }}
{% if show_author %}<br />
<small>{{ package.author.display_name }}</small>
{% endif %}
{% if not package.approved %}
<span class="badge ml-1 {% if package.state == package.state.CHANGES_NEEDED %}bg-danger{% else %}bg-warning{% endif %}">
{{ package.state.value }}
</span>
{% endif %}
</h3>
<p>
{{ package.short_desc }}
</p>
{% if not package.license.is_foss and not package.media_license.is_foss and package.type != package.type.TXP %}
<p style="color:#f33;">
{{ _("<b>Warning:</b> Non-free code and media.") }}
</p>
{% elif not package.license.is_foss and package.type != package.type.TXP %}
<p style="color:#f33;">
{{ _("<b>Warning:</b> Non-free code.") }}
</p>
{% elif not package.media_license.is_foss %}
<p style="color:#f33;">
{{ _("<b>Warning:</b> Non-free media.") }}
</p>
{% endif %}
</div>
</a></li>
{% endmacro %}
{% macro render_pkggrid(packages, show_author=True) -%}
<ul class="grid-4 gap-2 p-0">
{% for p in packages %}
{{ render_pkgtile(p, show_author) }}
{% else %}
<li class="packagetile"><i>{{ _("No packages available") }}</i></li>
{% endfor %}
</ul>
{% endmacro %}