-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(templates): add sortable_header template tag
The sortable_header inclusion tag renders a table header for a column for which a view provides sort functionality. The tag adds links to the header that include `sort` and `order` query parameters that can be used by the view to sort queryset results.
- Loading branch information
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
django/cantusdb_project/main_app/templates/tag_templates/sortable_header.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,11 @@ | ||
<th scope="col" class="text-wrap" style="text-align:center" title="{{ column_name }}"> | ||
{% if attr_is_currently_ordering %} | ||
{% if current_sort_param == "desc" %} | ||
<a href="{{ url_wo_sort_params }}&order={{ order_attribute }}&sort=asc">{{ column_name }}</a> ▼ | ||
{% else %} | ||
<a href="{{ url_wo_sort_params }}&order={{ order_attribute }}&sort=desc">{{ column_name }}</a> ▲ | ||
{% endif %} | ||
{% else %} | ||
<a href="{{ url_wo_sort_params }}&order={{ order_attribute }}&sort=asc">{{ column_name }}</a> | ||
{% endif %} | ||
</th> |
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