Skip to content

ENH: Expose issue sections in issue page context#5316

Open
kopfduenger wants to merge 1 commit into
openlibhums:masterfrom
kopfduenger:community/issue-sections-context
Open

ENH: Expose issue sections in issue page context#5316
kopfduenger wants to merge 1 commit into
openlibhums:masterfrom
kopfduenger:community/issue-sections-context

Conversation

@kopfduenger
Copy link
Copy Markdown

Summary

This adds an issue_sections context variable to the journal issue view.

issue_sections is 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 articles context is paginated, so grouping articles by section can miss sections that only appear on later pages.

Providing issue_sections gives themes a stable section list independent of article pagination, while keeping the existing paginated articles context unchanged.

Implementation

  • Reuses issue_object.get_sorted_articles() once in the issue view.
  • Builds issue_sections before pagination.
  • Keeps articles paginated as before.
  • Exposes issue_sections alongside the existing issue context.

Tests

Added a regression test that verifies:

  • issue_sections includes a section whose article falls beyond the first paginated page.
  • issue_sections excludes sections that only contain unpublished articles.
  • The existing paginated articles context remains paginated.

Test run:

lando python manage.py test journal.tests.test_journal_frontend.TestJournalSite.test_issue_sections_context_is_not_paginated

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.

1 participant