Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make "Country" and "Source" columns sortable on Source List page #1592

Merged
merged 3 commits into from
Aug 13, 2024

Conversation

dchiller
Copy link
Contributor

@dchiller dchiller commented Aug 9, 2024

Closes #1217 by making the source list page sortable by the "country" and "source" (city + institution + siglum) columns.

Additionally, this PR adds the sortable_header template tag. This tag renders a column header for a sortable column, reducing the need to repeat this construction multiple times in the source_list and other templates. This template tag can be reused in any template where we sort by column headers (I'm thinking here especially of the Chant Search table; I've made #1593 for this).

Finally, makes some minor code cleanliness changes to the SourceList view: annotates function return type and makes use of the assignment operator to reduce the number of statements in the get_queryset view.

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.
- add functionality to sort by a source's holding institution
country (the "Country" column) and city/name/siglum (the "Source"
column) in the Source List view
- use the sortable_header helper tag for sortable column headers
in the source_list.html template
- fix the value used in the source column to the source's heading
property
- remove unused variables
- reduce number of statements with assignment operator
Copy link
Contributor

@lucasmarchd01 lucasmarchd01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, the inclusion_tag is a neat feature

@dchiller dchiller merged commit ee12c96 into DDMAL:develop Aug 13, 2024
1 check passed
@dchiller dchiller deleted the i1217-source-list-sortable-columns branch August 13, 2024 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make source list page sortable by column headers
2 participants