]> git.lizzy.rs Git - cheatdb.git/blob - app/templates/packages/list.html
Add tag filter list to package page
[cheatdb.git] / app / templates / packages / list.html
1 {% extends "base.html" %}
2
3 {% block title %}
4 {{ title }}
5 {% endblock %}
6
7 {% block content %}
8         {% if authors %}
9                 <p class="alert alert-primary">
10                         Did you mean to search for packages by
11
12                         {% for author in authors %}
13                                 <a href="{{ url_for('packages.list_all', type=type, author=author[0], q=author[1]) }}">{{ author[0] }}</a>
14                                 {% if not loop.last %}
15                                 ,
16                                 {% endif %}
17                         {% endfor %}
18                         ?
19                 </p>
20         {% endif %}
21
22         <div class="row">
23                 <div class="col-md-9">
24                         {% from "macros/packagegridtile.html" import render_pkggrid %}
25                         {{ render_pkggrid(packages) }}
26
27
28                         {% from "macros/pagination.html" import render_pagination %}
29                         {{ render_pagination(pagination, url_set_query) }}
30
31
32                         {% if topics %}
33                                 <h2 style="margin-top:2em;">More content from the forums</h2>
34
35                                 {% from "macros/topics.html" import render_topics %}
36                                 {{ render_topics(topics, current_user) }}
37                         {% endif %}
38                 </div>
39
40                 <aside class="col-md-3">
41                         <p class="text-muted">Filter by tags</p>
42
43                         {% for pair in tags %}
44                                 {% set count = pair[0] %}
45                                 {% set tag = pair[1] %}
46
47                                 {% if tag in selected_tags %}
48                                         <a class="badge badge-primary"
49                                                         href="{{ url_set_query(page=1, _remove={ 'tag': tag.name }) }}">
50
51                                                 {{ tag.title }}
52                                                 ({{ count }})
53                                         </a>
54                                 {% else %}
55                                         <a class="badge badge-secondary"
56                                                         href="{{ url_set_query(page=1, _add={ 'tag': tag.name }) }}">
57
58                                                 {{ tag.title }}
59                                                 ({{ count }})
60                                         </a>
61                                 {% endif %}
62                         {% endfor %}
63                 </aside>
64         </div>
65
66 {% endblock %}