]> git.lizzy.rs Git - cheatdb.git/blobdiff - app/templates/packages/list.html
Add tag filter list to package page
[cheatdb.git] / app / templates / packages / list.html
index da0d80cac29b171cf5acbc89445df380e0df6e28..1cddcd477667cf5d443387e91fee739e2bf14a45 100644 (file)
                </p>
        {% endif %}
 
+       <div class="row">
+               <div class="col-md-9">
+                       {% from "macros/packagegridtile.html" import render_pkggrid %}
+                       {{ render_pkggrid(packages) }}
 
-       {% from "macros/packagegridtile.html" import render_pkggrid %}
-       {{ render_pkggrid(packages) }}
 
+                       {% from "macros/pagination.html" import render_pagination %}
+                       {{ render_pagination(pagination, url_set_query) }}
 
-       {% from "macros/pagination.html" import render_pagination %}
-       {{ render_pagination(pagination, url_set_query) }}
 
+                       {% if topics %}
+                               <h2 style="margin-top:2em;">More content from the forums</h2>
 
-       {% if topics %}
-               <h2 style="margin-top:2em;">More content from the forums</h2>
+                               {% from "macros/topics.html" import render_topics %}
+                               {{ render_topics(topics, current_user) }}
+                       {% endif %}
+               </div>
 
-               {% from "macros/topics.html" import render_topics %}
-               {{ render_topics(topics, current_user) }}
-       {% endif %}
+               <aside class="col-md-3">
+                       <p class="text-muted">Filter by tags</p>
+
+                       {% for pair in tags %}
+                               {% set count = pair[0] %}
+                               {% set tag = pair[1] %}
+
+                               {% if tag in selected_tags %}
+                                       <a class="badge badge-primary"
+                                                       href="{{ url_set_query(page=1, _remove={ 'tag': tag.name }) }}">
+
+                                               {{ tag.title }}
+                                               ({{ count }})
+                                       </a>
+                               {% else %}
+                                       <a class="badge badge-secondary"
+                                                       href="{{ url_set_query(page=1, _add={ 'tag': tag.name }) }}">
+
+                                               {{ tag.title }}
+                                               ({{ count }})
+                                       </a>
+                               {% endif %}
+                       {% endfor %}
+               </aside>
+       </div>
 
 {% endblock %}