]> git.lizzy.rs Git - cheatdb.git/blob - app/templates/macros/packagegridtile.html
306619478bf4629e025d95b7dfef9ab34ad172e9
[cheatdb.git] / app / templates / macros / packagegridtile.html
1 {% macro render_pkgtile(package, show_author) -%}
2         <li class="packagetile flex-fill"><a href="{{ package.getDetailsURL() }}"
3                 style="background-image: url({{ package.getThumbnailURL() or '/static/placeholder.png' }});">
4                 <div class="packagegridscrub"></div>
5                 <div class="packagegridinfo">
6                         <h3>
7                                 {{ package.title }}
8
9                                 {% if show_author %}<br />
10                                         <small>{{ package.author.display_name }}</small>
11                                 {% endif %}
12                         </h3>
13
14                         <p>
15                                 {{ package.short_desc }}
16                         </p>
17
18                         {% if not package.license.is_foss and not package.media_license.is_foss and package.type != package.type.TXP  %}
19                                 <p style="color:#f33;">
20                                         <b>Warning:</b> Non-free code and media.
21                                 </p>
22                         {% elif not package.license.is_foss and package.type != package.type.TXP %}
23                                 <p style="color:#f33;">
24                                         <b>Warning:</b> Non-free code.
25                                 </p>
26                         {% elif not package.media_license.is_foss %}
27                                 <p style="color:#f33;">
28                                         <b>Warning:</b> Non-free media.
29                                 </p>
30                         {% endif %}
31                 </div>
32         </a></li>
33 {% endmacro %}
34
35 {% macro render_pkggrid(packages, show_author=True) -%}
36         <ul class="d-flex p-0 flex-row flex-wrap justify-content-start align-content-start ">
37                 {% for p in packages %}
38                         {{ render_pkgtile(p, show_author) }}
39                 {% else %}
40                         <li><i>No packages available</i></ul>
41                 {% endfor %}
42                 {% if packages %}
43                         {% for i in range(4) %}
44                                 <li class="packagetile flex-fill"></li>
45                         {% endfor %}
46                 {% endif %}
47         </ul>
48 {% endmacro %}