-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add category browsing functionality to store
Fixes #4
- Loading branch information
1 parent
0cf8f7c
commit ff4648d
Showing
4 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
printrov_merch_store/templates/includes/categories_macro.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% macro categories_list_group(active_category=None) %} | ||
{% set categories_with_count = get_categories_with_count() %} | ||
<div class="list-group"> | ||
<a href="/store" class="list-group-item list-group-item-action d-flex justify-content-between align-items-center {{ 'active' if (not active_category) else '' }}" aria-current="true"> | ||
All | ||
<span class="badge badge-primary badge-pill">{{ categories_with_count.values()|sum }}</span> | ||
</a> | ||
{% for category, count in categories_with_count.items() %} | ||
<a href="/store?category={{category}}" class="list-group-item list-group-item-action d-flex justify-content-between align-items-center {{ 'active' if category == active_category else '' }}" aria-current="true"> | ||
{{ category }} | ||
<span class="badge badge-primary badge-pill">{{ count }}</span> | ||
</a> | ||
{% endfor %} | ||
</div> | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters