forked from rero/rero-ils-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
entities: some improve navigation and links
* Adds a new tab for related entities on document detail view. * Updates contribution, subject and genreForm to relaunch a search. * Updates search documents on entities detail view to target certain fields only. * rero/rero-ils#3513. Co-Authored-by: Bertrand Zuchuat <[email protected]>
- Loading branch information
1 parent
83944cc
commit b76d8a3
Showing
20 changed files
with
473 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
.../record/detail-view/document-detail-view/entities-related/entities-related.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!-- | ||
RERO ILS UI | ||
Copyright (C) 2019-2023 RERO | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, version 3 of the License. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
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/>. | ||
--> | ||
<div class="container"> | ||
<div [class]="i%2 === 0 ? 'bg-light':''" class="row" *ngFor="let field of entities | keyvalue; let i = index"> | ||
<div class="font-weight-bold col-3 py-1" translate> | ||
{{ field.key | translate |ucfirst }} | ||
</div> | ||
<div class="col-9 py-1"> | ||
<ul class="list-unstyled mb-0"> | ||
<li *ngFor="let entity of field.value"> | ||
<i title="{{ entity.type | translate }}" class="fa {{ entity.icon }} mr-2"></i> | ||
<a [routerLink]="['/records', entity.resource_type + '_entities', 'detail', entity.pid]">{{ entity.authorized_access_point }}</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> |
63 changes: 63 additions & 0 deletions
63
...pp/record/detail-view/document-detail-view/entities-related/entities-related.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* RERO ILS UI | ||
* Copyright (C) 2019-2023 RERO | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, version 3 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* 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/>. | ||
*/ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { TranslateService } from '@ngx-translate/core'; | ||
import { Entity } from '@rero/shared'; | ||
import { IEntityRelated } from './entities-related.interface'; | ||
|
||
@Component({ | ||
selector: 'admin-entities-related', | ||
templateUrl: './entities-related.component.html' | ||
}) | ||
export class EntitiesRelatedComponent implements OnInit { | ||
|
||
/** Record metadata */ | ||
@Input() record: any; | ||
|
||
/** Entities processed */ | ||
entities: {[key: string]: IEntityRelated[]} = {}; | ||
|
||
/** | ||
* Constructor | ||
* @param translateService - TranslateService | ||
*/ | ||
constructor(private translateService: TranslateService) {} | ||
|
||
/** OnInit hook */ | ||
ngOnInit(): void { | ||
const language = this.translateService.currentLang; | ||
const { metadata } = this.record; | ||
Entity.FIELDS_WITH_REF.forEach((field: string) => { | ||
if (field in metadata && metadata[field].length > 0) { | ||
metadata[field].forEach((entity: any) => { | ||
if (entity.entity.resource_type) { | ||
if (!Object.keys(this.entities).includes(field)) { | ||
this.entities[field] = []; | ||
} | ||
this.entities[field].push({ | ||
authorized_access_point: entity.entity[`authorized_access_point_${language}`], | ||
pid: entity.entity.pid, | ||
resource_type: entity.entity.resource_type, | ||
type: entity.entity.type, | ||
icon: Entity.getIcon(entity.entity.type) | ||
}); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.