Skip to content

Commit

Permalink
refactor(entity): add identifiedBy on all ressources
Browse files Browse the repository at this point in the history
* Adds identifiedBy uri on all ressources.
* Translates subject to language change.

Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
Garfield-fr committed Sep 11, 2024
1 parent 5b9fc2e commit b7dc521
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 225 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,59 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
@if (record$ | async; as record) {
<h1 class="mb-0" *ngVar="icon($any(record).metadata.type) as icon">
<i class="fa {{ icon.class }}" title="{{ icon.title }}" aria-hidden="true"></i>
{{ $any(record).metadata | extractSourceField : 'authorized_access_point' }}</h1>
<small>
{{ 'MEF ID' | translate }}: {{ $any(record).metadata.pid }}
</small>
<span class="badge badge-warning" translate>Remote</span>
<h1 class="mb-0" *ngVar="icon($any(record).metadata.type) as icon">
<i class="fa {{ icon.class }}" title="{{ icon.title }}" aria-hidden="true"></i>
{{ $any(record).metadata | extractSourceField : 'authorized_access_point' }}</h1>
<small>
{{ 'MEF ID' | translate }}: {{ $any(record).metadata.pid }}
</small>
<span class="badge badge-warning" translate>Remote</span>

<!-- SOURCES -->
@for (source of $any(record).metadata.sources.sort(); track source) {
<article class="card my-2">
<header class="card-header">
<b class="card-title mb-0">
{{ source | translate | uppercase }}
</b>
</header>
<article id="contribution-{{ source }}" class="card-body collapse show">
<!-- SOURCES -->
@for (source of $any(record).metadata.sources.sort(); track source) {
<article class="card my-2">
<header class="card-header">
<b class="card-title mb-0">{{ source | translate | uppercase }}</b>
</header>
<article id="contribution-{{ source }}" class="card-body collapse show">
<dl class="entity-fields">
@switch ($any(record).metadata.type) {
@case (entityType.PERSON) {
<admin-remote-entities-person-detail-view [record]="$any(record).metadata[source]" [source]="source"></admin-remote-entities-person-detail-view>
<admin-remote-entities-person-detail-view [record]="$any(record).metadata[source]" [source]="source" />
}
@case (entityType.ORGANISATION) {
<admin-remote-entities-organisation-detail-view [record]="$any(record).metadata[source]" [source]="source"></admin-remote-entities-organisation-detail-view>
<admin-remote-entities-organisation-detail-view [record]="$any(record).metadata[source]" [source]="source" />
}
@case (entityType.TOPIC) {
<admin-remote-topic-detail-view [record]="$any(record).metadata[source]" [source]="source"></admin-remote-topic-detail-view>
<admin-remote-topic-detail-view [record]="$any(record).metadata[source]" [source]="source" />
}
@case (entityType.PLACE) {
<admin-remote-topic-detail-view [record]="$any(record).metadata[source]" [source]="source"></admin-remote-topic-detail-view>
<admin-remote-topic-detail-view [record]="$any(record).metadata[source]" [source]="source" />
}
@case (entityType.TEMPORAL) {
<admin-remote-topic-detail-view [record]="$any(record).metadata[source]" [source]="source"></admin-remote-topic-detail-view>
<admin-remote-topic-detail-view [record]="$any(record).metadata[source]" [source]="source" />
}
@default {
{{ 'Missing template for this entity type:' | translate }} {{ $any(record).metadata.type }}
}
}
</article>
<!-- IDENTIFIED BY -->
@if (identifiedByFilter($any(record).metadata[source].identifiedBy).length > 0) {
<dt translate>Identified by</dt>
<dd>
<ul>
@for (identifiedBy of identifiedByFilter($any(record).metadata[source].identifiedBy); track identifiedBy) {
<li>
<a href="{{ identifiedBy.value }}" title="{{ identifiedBy.value }}" target="_blank">{{ identifiedBy.source }}</a>
</li>
}
</ul>
</dd>
}
<dt translate>Id</dt>
<dd>{{ $any(record).metadata[source].pid }}</dd>
</dl>
</article>
}
</article>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,8 @@ export class RemoteEntitiesDetailViewComponent implements DetailRecord {
};
}
}

identifiedByFilter(identifiedBy: any[]): any[] {
return identifiedBy.filter((el: any) => el.source !== 'RERO' && el.type === 'uri');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,59 +15,46 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<dl class="entity-fields">
<!-- DATE OF ESTABLISHMENT -->
@if (record.date_of_establishment) {
<dt translate>Date of establishment</dt>
<dd>{{ record.date_of_establishment }}</dd>
}
<!-- DATE OF TERMINATION -->
@if (record.date_of_termination) {
<dt translate>Date of termination</dt>
<dd>{{ record.date_of_termination }}</dd>
}
<!-- LANGUAGE -->
@if (record.language) {
<dt translate>Language</dt>
<dd>
<ul>
@for (language of record.language; track language) {
<li>{{ ('lang_' + language) | translate }}</li>
}
</ul>
</dd>
}
<!-- COUNTRY ASSOCIATED -->
@if (record.country_associated) {
<dt translate>Country associated</dt>
<dd>{{ 'country_' + record.country_associated | translate }}</dd>
}
<!-- DATE OF ESTABLISHMENT -->
@if (record.date_of_establishment) {
<dt translate>Date of establishment</dt>
<dd>{{ record.date_of_establishment }}</dd>
}
<!-- DATE OF TERMINATION -->
@if (record.date_of_termination) {
<dt translate>Date of termination</dt>
<dd>{{ record.date_of_termination }}</dd>
}
<!-- LANGUAGE -->
@if (record.language) {
<dt translate>Language</dt>
<dd>
<ul>
@for (language of record.language; track language) {
<li>{{ ('lang_' + language) | translate }}</li>
}
</ul>
</dd>
}
<!-- COUNTRY ASSOCIATED -->
@if (record.country_associated) {
<dt translate>Country associated</dt>
<dd>{{ 'country_' + record.country_associated | translate }}</dd>
}

<!-- AUTHORIZED ACCESS POINT -->
@if (record.authorized_access_point) {
<dt translate>Authorized access point</dt>
<dd>{{ record.authorized_access_point }}</dd>
}
<!-- VARIANT NAME -->
@if (record.variant_access_point) {
<dt translate>Variant name</dt>
<dd>
<ul>
@for (variant_name of record.variant_access_point; track variant_name) {
<li>{{ variant_name }}</li>
}
</ul>
</dd>
}
<!-- ID -->
@if (record.identifier) {
<dt translate>Id</dt>
<dd>
@if (disabledLink(source)) {
<a [href]="record.identifier | safeUrl">{{ record.pid }}</a>
} @else {
{{ record.pid }}
<!-- AUTHORIZED ACCESS POINT -->
@if (record.authorized_access_point) {
<dt translate>Authorized access point</dt>
<dd>{{ record.authorized_access_point }}</dd>
}
<!-- VARIANT NAME -->
@if (record.variant_access_point) {
<dt translate>Variant name</dt>
<dd>
<ul>
@for (variant_name of record.variant_access_point; track variant_name) {
<li>{{ variant_name }}</li>
}
</dd>
}
</dl>
</ul>
</dd>
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,68 +15,55 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<dl class="entity-fields">
<!-- DATE OF BIRTH -->
@if (record.date_of_birth) {
<dt translate>Birth date</dt>
<dd>{{ record.date_of_birth }}</dd>
}
<!-- DATE OF DEATH -->
@if (record.date_of_death) {
<dt translate>Death date</dt>
<dd>{{ record.date_of_death }}</dd>
}
<!-- LANGUAGE -->
@if (record.language) {
<dt translate>Language</dt>
<dd>
<ul>
@for (language of record.language; track language) {
<li>{{ ('lang_' + language) | translate }}</li>
}
</ul>
</dd>
}
<!-- GENDER -->
@if (record.Gender) {
<dt translate>Gender</dt>
<dd>{{ record.Gender }}</dd>
}
<!-- BIBLIOGRAPHICAL INFORMATION -->
@if (record.biographical_information) {
<dt translate>Biographical information</dt>
<dd [innerHtml]="record.biographical_information.join('\n') | urlActive | nl2br"></dd>
}
<!-- NAME -->
@if (record.name) {
<dt translate>Name</dt>
<dd>{{ record.name }}</dd>
}
<!-- VARIANT ACCESS POINT -->
@if (record.variant_access_point) {
<dt translate>Variant name</dt>
<dd>
<ul>
@for (variant_name of record.variant_access_point; track variant_name) {
<li>{{ variant_name }}</li>
}
</ul>
</dd>
}
<!-- AUTHORIZED ACCESS POINT -->
@if (record.authorized_access_point) {
<dt translate>Authorized access point</dt>
<dd>{{ record.authorized_access_point }}</dd>
}
<!-- ID -->
@if (record.identifier) {
<dt translate>Id</dt>
<dd>
@if (disabledLink(source)) {
<a href="{{ record.identifier }}">{{ record.pid }}</a>
} @else {
{{ record.pid }}
<!-- DATE OF BIRTH -->
@if (record.date_of_birth) {
<dt translate>Birth date</dt>
<dd>{{ record.date_of_birth }}</dd>
}
<!-- DATE OF DEATH -->
@if (record.date_of_death) {
<dt translate>Death date</dt>
<dd>{{ record.date_of_death }}</dd>
}
<!-- LANGUAGE -->
@if (record.language) {
<dt translate>Language</dt>
<dd>
<ul>
@for (language of record.language; track language) {
<li>{{ ('lang_' + language) | translate }}</li>
}
</dd>
}
</dl>
</ul>
</dd>
}
<!-- GENDER -->
@if (record.Gender) {
<dt translate>Gender</dt>
<dd>{{ record.Gender }}</dd>
}
<!-- BIBLIOGRAPHICAL INFORMATION -->
@if (record.biographical_information) {
<dt translate>Biographical information</dt>
<dd [innerHtml]="record.biographical_information.join('\n') | urlActive | nl2br"></dd>
}
<!-- NAME -->
@if (record.name) {
<dt translate>Name</dt>
<dd>{{ record.name }}</dd>
}
<!-- VARIANT ACCESS POINT -->
@if (record.variant_access_point) {
<dt translate>Variant name</dt>
<dd>
<ul>
@for (variant_name of record.variant_access_point; track variant_name) {
<li>{{ variant_name }}</li>
}
</ul>
</dd>
}
<!-- AUTHORIZED ACCESS POINT -->
@if (record.authorized_access_point) {
<dt translate>Authorized access point</dt>
<dd>{{ record.authorized_access_point }}</dd>
}
Loading

0 comments on commit b7dc521

Please sign in to comment.