Skip to content

ZCU-PUB/feat(community): show "Články" collection 3rd, after "Kapitoly v knihách" (#953) - #1492

Merged
milanmajchrak merged 6 commits into
customer/zcu-pubfrom
zcu-pub/fe-issue-953-articles-3rd-position
Sep 7, 2026
Merged

ZCU-PUB/feat(community): show "Články" collection 3rd, after "Kapitoly v knihách" (#953)#1492
milanmajchrak merged 6 commits into
customer/zcu-pubfrom
zcu-pub/fe-issue-953-articles-3rd-position

Conversation

@Kasinhou

@Kasinhou Kasinhou commented Sep 2, 2026

Copy link
Copy Markdown

Problem

In the ZCU publications community each department lists its sub-collections alphabetically by dc.title. Because "Články" (Č) sorts after the Latin A–Z, the articles collection always ends up last. The customer wants "Články" shown directly after "Kapitoly v knihách" (book parts):

  • book parts 2nd → articles 3rd,
  • book parts 1st → articles 2nd,

i.e. articles tracks book parts wherever it naturally sits.

Approach

  • Ordering rule lives in one shared pure helper: src/app/shared/zcu-collection-order.ts.
  • Rule: keep book parts and every other collection in their natural (alphabetical) position; move only "Články" to sit immediately after "Kapitoly v knihách". No-op when either collection is missing or they are already adjacent — book parts itself is never relocated.
  • Matching is by Czech title prefix (trimmed, case-insensitive), so every naming variant used across departments is handled: Články, Články / Articles, Články / Articles (KAE), and likewise Kapitoly v knihách / Bookparts (KAE). Because collection titles are data (not UI translations), the match is independent of the interface language.
  • Applied in both places that list a community's collections:
    • community detail page — the themed sub-collection-list override delegates to the helper; the base component keeps a no-op applyCustomCollectionOrder() seam so other themes/customers are unaffected;
    • community browse tree (/community-list) — CommunityListService reorders each fetched collection page.

Change set

File Change
src/app/shared/zcu-collection-order.ts Shared pure helper reorderZcuPublicationCollections() + prefix constants + prefix matcher.
src/app/shared/zcu-collection-order.spec.ts Unit tests for the rule (incl. bilingual/suffixed names).
src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.ts No-op applyCustomCollectionOrder() seam, applied to the fetched page.
src/themes/custom/app/community-page/sub-collection-list/community-page-sub-collection-list.component.ts Override the seam; delegate to the shared helper.
src/themes/custom/app/community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts Tests for the themed override.
src/app/community-list-page/community-list-service.ts Apply the shared helper to each collection page in the browse tree.

Verification

  • Unit specs cover: book parts 2nd → articles 3rd; book parts 1st → articles 2nd; production bilingual/suffixed names (Kapitoly v knihách / Bookparts (KAE), Články / Articles (KAE)); mixed variants; already-adjacent (no-op); anchor missing (no-op); empty / single-element input.
  • End-to-end, on a local zcu-pub stack (build:prod SSR) seeded with a Publikační činnost → faculty → department hierarchy containing both plain-Czech and bilingual/suffixed departments: in both the /community-list tree and the community detail page, "Články" renders directly after "Kapitoly v knihách" in every case.

Scope / notes

  • Only the "articles directly after book parts" constraint is encoded; a general admin-orderable collection order is out of scope.
  • zcu-data: not applicable — its active theme is dspace (not custom) and it holds research-data collections, not these publication types.

Risk / rollback

  • Low. Pure array reshaping, SSR-safe; a guarded no-op whenever both anchor collections aren't present. The base-component change is a passthrough. Rollback: revert the commits — ordering returns to alphabetical.

Fixes dataquest-dev/dspace-customers#953

…y v knihách" (#953)

Hardcode the display order for the ZCU publications community so that the
"Články" collection appears in 3rd position, immediately after "Kapitoly v
knihách", while all other collections keep their existing alphabetical order.

Approach: the base sub-collection-list component gains a no-op
`applyCustomCollectionOrder` seam applied to each fetched page, keeping
behavior identical for every other theme/customer. The custom theme overrides
it to pin the two named collections via a small, unit-tested pure
`reorderCollections` helper.

Assumption: only the "Články -> 3rd" constraint is encoded here; a full
configurable custom ordering would be the separate Option B feature.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The base change is a no-op extension point, and the custom-theme ordering is narrowly scoped, guarded, and covered by unit tests.

Pull request overview

Adds a theme-extensible hook to customize the display order of community sub-collections and uses it in the custom theme to pin "Kapitoly v knihách" and "Články" into fixed 2nd/3rd positions for the ZCU publications community while keeping the remaining collections in their existing (alphabetical) order.

Changes:

  • Introduce a protected extension seam applyCustomCollectionOrder(rd) in the base sub-collection list component and apply it before emitting results.
  • Implement ZCU-specific ordering in the custom theme via applyCustomCollectionOrder() + a pure reorderCollections() helper using named constants for the pinned titles.
  • Add unit tests in the custom theme for the reorder rule and its guard conditions.
File summaries
File Description
src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.ts Adds a protected no-op ordering hook and invokes it when emitting fetched sub-collections.
src/themes/custom/app/community-page/sub-collection-list/community-page-sub-collection-list.component.ts Overrides the hook to apply the ZCU-specific pinned 2nd/3rd ordering based on exact collection names.
src/themes/custom/app/community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts Adds focused unit tests covering the pinning behavior and non-applicability cases.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Matus Kasak and others added 5 commits September 3, 2026 10:18
…ty browse tree (#953)

The initial fix only reordered the community *detail* page (the themed
sub-collection list). The "Communities & Collections" browse tree
(/community-list) renders collections through CommunityListService and was
still showing the default alphabetical order (Články last).

Extract the ordering rule into a shared pure helper
(shared/zcu-collection-order.ts) and apply it in both places:
- the custom-theme sub-collection-list override (delegates to the helper),
- CommunityListService (reorders each fetched collection page in the tree).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ch" (#953)

The previous #953 hardcode force-pinned "Kapitoly v knihách" to the 2nd slot
and "Články" to the 3rd, which is wrong whenever book parts is not naturally
2nd. Per the refined requirement, "Články" must simply follow book parts
wherever it sits: book parts 1st -> articles 2nd, book parts 2nd -> articles
3rd, etc. Book parts and every other collection keep their natural
(alphabetical) order; only "Články" moves.

reorderZcuPublicationCollections now finds book parts, removes "Články", and
re-inserts it immediately after book parts (no-op when either is absent or they
are already adjacent). Constants renamed ZCU_{SECOND,THIRD} ->
ZCU_{BOOKPARTS,ARTICLES}_COLLECTION_NAME to stop implying fixed positions. The
shared helper is used by both the community page (themed sub-collection-list)
and the community browse tree (CommunityListService), so both are fixed.

Verified end-to-end on a seeded Publikační činnost hierarchy: a department with
book parts 2nd shows Články 3rd, and one with book parts 1st shows Články 2nd,
in both the /community-list tree and the community detail page.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e prefix

Departments name these collections inconsistently ("Články",
"Články / Articles", "Články / Articles (KAE)", and the same pattern for
"Kapitoly v knihách / Bookparts (KAE)"). The exact-name match only handled the
plain Czech variant, so the reorder never fired for most departments. Match by
Czech title prefix (trimmed, case-insensitive) so every bilingual/suffixed
variant is handled regardless of UI language.
@milanmajchrak
milanmajchrak merged commit 1bb0366 into customer/zcu-pub Sep 7, 2026
5 checks passed
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.

3 participants