Skip to content

153 ror shared helper#159

Open
kosarko wants to merge 3 commits into
151-support-for-ror-identifiersfrom
153-ror-shared-helper
Open

153 ror shared helper#159
kosarko wants to merge 3 commits into
151-support-for-ror-identifiersfrom
153-ror-shared-helper

Conversation

@kosarko

@kosarko kosarko commented Jun 30, 2026

Copy link
Copy Markdown
Member

extracted the repeated code to a helper method
autogenerated tests

kosarko and others added 2 commits June 30, 2026 08:04
…eativework.publisher

Follow-up cleanup on the ROR publisher support (PR #153):

- Add buildAuthoritySearchFilter() in clarin-shared-util.ts and use it from
  getLinkToSearch (generic item field), the search-result box view, and
  loadItemAuthors, so the authority-vs-equals operator logic lives in one place.
- Drop creativework.publisher from the CLARIN item view (untyped-item fields,
  the ROR icon condition and convertMetadataFieldIntoSearchType) so the item
  page and the search card agree on dc.publisher. Journal entity pages, which
  use the upstream ds-generic-item-page-field, are unaffected.
- Add a clarin-generic-item-field spec covering getLinkToSearch branches and a
  unit test for the new helper.

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

This PR extracts repeated “authority vs equals” search-filter construction logic into a shared helper and updates components to use it, with accompanying unit tests to validate the new behavior.

Changes:

  • Added buildAuthoritySearchFilter helper to centralize discovery filter query fragment generation (authority-aware).
  • Refactored author/publisher search-link creation to use the helper.
  • Added unit tests for the helper and for ClarinGenericItemFieldComponent.getLinkToSearch.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/app/shared/clarin-shared-util.ts Introduces buildAuthoritySearchFilter and reuses it for author search links.
src/app/shared/clarin-shared-util.spec.ts Adds unit coverage for buildAuthoritySearchFilter and convertMetadataFieldIntoSearchType.
src/app/shared/clarin-item-box-view/clarin-item-box-view.component.ts Switches publisher search-link building to the shared helper and broadens publisher metadata lookup.
src/app/shared/clarin-item-box-view/clarin-item-box-view.component.html Simplifies publisher link rendering (but currently introduces an async-initialization link issue).
src/app/item-page/simple/field-components/clarin-generic-item-field/clarin-generic-item-field.component.ts Refactors search link creation to use the shared helper and handle explicit-value searches.
src/app/item-page/simple/field-components/clarin-generic-item-field/clarin-generic-item-field.component.spec.ts Adds unit tests for authority vs equals link generation and edge cases.

<div *ngIf="isSearchResult" class="pt-1">
<div class="font-weight-bold">{{ 'item.view.box.publisher.message' | translate }}</div>
<span>(<span *ngIf="itemPublisher != null"><a *ngIf="publisherRedirectLink" [href]="publisherRedirectLink">{{itemPublisher}} <img *ngIf="hasPublisherRorAuthority" src="assets/images/ror-icon.svg" alt="ROR ID" height="16" class="ml-1 align-middle"></a><span *ngIf="!publisherRedirectLink">{{itemPublisher}}</span> / </span>{{itemDate}})</span>
<span>(<span *ngIf="itemPublisher != null"><a [href]="publisherRedirectLink">{{itemPublisher}} <img *ngIf="hasPublisherRorAuthority" src="assets/images/ror-icon.svg" alt="ROR ID" height="16" class="ror-icon ml-1 align-middle"></a> / </span>{{itemDate}})</span>
Use [attr.href] instead of [href] so Angular omits the attribute while
publisherRedirectLink is still undefined (before assignBaseUrl resolves),
rendering the publisher as plain text until the URL is ready.
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