Skip to content

JCU/Port CitacePRO citation widget from customer/mendelu#1356

Open
Kasinhou wants to merge 3 commits into
customer/jcufrom
feature/jcu-citacepro
Open

JCU/Port CitacePRO citation widget from customer/mendelu#1356
Kasinhou wants to merge 3 commits into
customer/jcufrom
feature/jcu-citacepro

Conversation

@Kasinhou

@Kasinhou Kasinhou commented Jul 6, 2026

Copy link
Copy Markdown

What is CitacePRO?

CitacePRO is a Czech citation-generation service. On an item page it renders a citation for the item (composed by CitacePRO from the metadata it harvests via OAI‑PMH from the institution's public repository) together with a "Uložit do Citace PRO" button, inside an embedded <iframe>.

This PR ports the CitacePRO item‑page widget from customer/mendelu to customer/jcu, adapted for JCU.

What was ported

  • New standalone component ItemPageCitationFieldComponent (ds-item-page-citation-field) under src/app/item-page/simple/field-components/specific-field/citation/ (.ts, .html, .scss, .spec.ts).
    • Reads citace.pro.url, citace.pro.university, citace.pro.allowed via ConfigurationDataService (REST /config/properties/*).
    • Builds the iframe URL <url>:<university>:<handle> and shows the iframe only when citace.pro.allowed = true.
  • Wiring into the two item views that mendelu wired, for both the base app and the custom theme:
    • src/app/item-page/simple/item-types/publication/publication.component.{ts,html}
    • src/app/item-page/simple/item-types/untyped-item/untyped-item.component.{ts,html}
    • src/themes/custom/app/.../publication/publication.component.ts and .../untyped-item/untyped-item.component.ts (they reuse the base HTML, so they only need the component registered in imports).

JCU adaptations vs. mendelu

  • The mendelu "generated by software / ČSN ISO 690" disclaimer shown under the iframe is intentionally omitted for JCU, so no new i18n keys are added (and TranslateModule is not imported by the component).
  • Removed mendelu's redundant standalone: true on the component (JCU's dspace-angular-ts/no-default-standalone-value lint rule flags it; the imports array keeps the component standalone).

Source (customer/mendelu)

Branch: https://github.com/dataquest-dev/dspace-angular/tree/customer/mendelu

Also not ported (unrelated refactor bundled into #1161): the contact-page.component.ts AsyncPipe → CommonModule swap.

Backend dependency

Requires the CitacePRO config exposed over REST — see the companion backend PR (dataquest-dev/DSpace, branch feature/jcu-citacepro). Without it the widget stays hidden (fails closed).

⚠️ JCU-specific value still needed

  • citace.pro.university is currently a placeholder on the backend (dspace.jcu.cz). CitacePRO composes the citation from what it has harvested under this identifier from JCU's production repository, so live citation content will only appear once the real JCU CitacePRO-registered host is set and JCU's repo is harvested by CitacePRO. The DSpace-side integration (widget, URL composition, allowed-flag gating) is complete and works regardless.

Verification

  • Compiles: the running dev container (ng serve) recompiled cleanly — ✔ Compiled successfully, no new warnings for the ported files.
  • Renders: verified in-browser at http://localhost:4000 on item pages — ds-item-page-citation-field present, iframe src="https://www.citacepro.com/api/dspace/citace/oai:dspace.jcu.cz:<handle>", no disclaimer paragraph. Console shows no citace-related errors.
  • Lint (eslint in the FE container, on the changed files): passes.
  • ℹ️ Unit test: the spec is verbatim from the merged mendelu PRs; not executed here because the repo's test tier needs a Node/toolchain (Node 22 + Corepack-managed PM) not available on the host. Recommend confirming via CI.

Adds the CitacePRO citation widget to the item page for JCU, mirroring the
customer/mendelu implementation.

- New standalone ItemPageCitationFieldComponent (ds-item-page-citation-field):
  reads citace.pro.url / citace.pro.university / citace.pro.allowed via
  ConfigurationDataService and embeds the CitacePRO iframe
  (<url>:<university>:<handle>) with a disclaimer, shown only when
  citace.pro.allowed = true.
- Wired into publication + untyped-item item views (base app and themes/custom).
- Added item.page.citace-pro.disclaimer to en/cs i18n.

Ported from dataquest-dev/dspace-angular #1161 (initial component + wiring),
#1166 (always-render fix), #1167 (only the citation spec tweak, not the
unrelated bundled UI files), and #1264 (disclaimer text + i18n).

Requires the backend citace.pro.* config exposed via REST
(dataquest-dev/DSpace feature/jcu-citacepro).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2308bfe9-a95a-45c9-ab90-91a5ec1bb957

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The "These citations were generated by software ... ČSN ISO 690" disclaimer
shown under the CitacePRO iframe is mendelu-specific and not wanted for JCU.

- Remove the <p> disclaimer from item-page-citation.component.html
- Drop the now-unused TranslateModule import from the component
- Remove item.page.citace-pro.disclaimer from en.json5 and cs.json5

Co-Authored-By: Claude Opus 4.8 (1M context) <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.

Pull request overview

Ports the CitacePRO citation iframe widget into the JCU frontend item pages, exposing it as a reusable field component and wiring it into both base and custom-theme publication/untyped item views.

Changes:

  • Added ds-item-page-citation-field standalone field component that builds an iframe URL from REST config (citace.pro.*) and a handle.
  • Inserted the new field into simple item page templates for Publication and UntypedItem.
  • Registered the component in the corresponding base app and themes/custom item-type components’ imports.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/app/item-page/simple/field-components/specific-field/citation/item-page-citation.component.ts New CitacePRO field component (config fetch + URL composition).
src/app/item-page/simple/field-components/specific-field/citation/item-page-citation.component.html Renders gated iframe when allowed + URL is available.
src/app/item-page/simple/field-components/specific-field/citation/item-page-citation.component.scss Styling file added for the new component.
src/app/item-page/simple/field-components/specific-field/citation/item-page-citation.component.spec.ts Unit test for the new component.
src/app/item-page/simple/item-types/publication/publication.component.ts Imports/registers the new citation field component.
src/app/item-page/simple/item-types/publication/publication.component.html Adds the citation field into the publication view layout.
src/app/item-page/simple/item-types/untyped-item/untyped-item.component.ts Imports/registers the new citation field component.
src/app/item-page/simple/item-types/untyped-item/untyped-item.component.html Adds the citation field into the untyped-item view layout.
src/themes/custom/app/item-page/simple/item-types/publication/publication.component.ts Adds the citation field to custom-theme publication component imports.
src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.ts Adds the citation field to custom-theme untyped-item component imports.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Address the failing CI and the Copilot review on PR #1356:

- publication.component.spec.ts: provide ConfigurationDataServiceStub
  (same pattern as the passing untyped-item spec). PublicationComponent
  now renders ds-item-page-citation-field, whose ngOnInit called the
  real ConfigurationDataService against the spec's bare
  HALEndpointService stub (this.halService.getEndpoint is not a
  function), failing all 12 PublicationComponent tests on CI.
- item-page-citation.component.ts: allow only http(s) base URLs before
  bypassSecurityTrustResourceUrl, so a bad citace.pro.url config value
  (e.g. javascript:) can never be trusted as iframe src.
- item-page-citation.component.html: add an accessibility title to the
  iframe, and shrink the wrapper spacing mb-5 pb-4 -> mb-2. The large
  spacing was inherited from mendelu where a disclaimer paragraph sat
  under the iframe; JCU dropped the disclaimer, which left ~72px of
  empty space between the citation and the abstract. Iframe untouched.
- item-page-citation.component.spec.ts: name-based config mock and
  behavior assertions (allowed=true -> URL composed + iframe rendered
  with title; allowed=false -> hidden; non-http(s)/missing config ->
  null), replacing the existence-only checks.
- item-page-citation.component.scss: removed; it contained only a
  comment and was never referenced by the component (styleUrls).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Kasinhou Kasinhou self-assigned this Jul 6, 2026
@Kasinhou

Kasinhou commented Jul 6, 2026

Copy link
Copy Markdown
Author

current state:
image

@Kasinhou Kasinhou requested a review from milanmajchrak July 6, 2026 14:31
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.

2 participants