ENH: Expose issue sections in issue page context#5316
Open
kopfduenger wants to merge 1 commit into
Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds an
issue_sectionscontext variable to the journal issue view.issue_sectionsis built from the issue’s unpaginated, sorted, published articles and preserves the section order while removing duplicate sections.Rationale
Issue templates may need a section-level table of contents or navigation. The existing
articlescontext is paginated, so groupingarticlesby section can miss sections that only appear on later pages.Providing
issue_sectionsgives themes a stable section list independent of article pagination, while keeping the existing paginatedarticlescontext unchanged.Implementation
issue_object.get_sorted_articles()once in the issue view.issue_sectionsbefore pagination.articlespaginated as before.issue_sectionsalongside the existing issue context.Tests
Added a regression test that verifies:
issue_sectionsincludes a section whose article falls beyond the first paginated page.issue_sectionsexcludes sections that only contain unpublished articles.articlescontext remains paginated.Test run:
lando python manage.py test journal.tests.test_journal_frontend.TestJournalSite.test_issue_sections_context_is_not_paginated