Skip to content

Commit

Permalink
primeng: admin collections
Browse files Browse the repository at this point in the history
Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
  • Loading branch information
jma and Garfield-fr committed Dec 9, 2024
1 parent 6e6c34a commit b6a0329
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,32 @@ import { ResultItem } from '@rero/ng-core';
@Component({
selector: 'admin-collection-brief',
template: `
<h5 class="mb-0 card-title">
<i class="fa fa-circle mr-1 text-{{ record.metadata.published ? 'success' : 'danger' }}" aria-hidden="true"></i>
<a id="collection-link" [routerLink]="[detailUrl.link]">{{ record.metadata.title }}</a>
@if (record.metadata.collection_id) {
({{ record.metadata.collection_id }})
}
</h5>
<div class="card-text">
@if (record.metadata.teachers) {
<div id="collection-teacher">
@for (teacher of record.metadata.teachers; track teacher; let last = $last) {
{{ teacher.name }} {{ last ? '' : ', ' }}
<div class="flex flex-column gap-1">
<h5>
<i class="fa fa-circle mr-1" [ngClass]="{'text-success': record.metadata.published, 'text-error': !record.metadata.published}" aria-hidden="true"></i>
<a id="collection-link" [routerLink]="[detailUrl.link]">{{ record.metadata.title }}</a>
@if (record.metadata.collection_id) {
({{ record.metadata.collection_id }})
}
</div>
}
@if (record.metadata.description) {
<div
id="collection-start-end-date"
[innerHtml]="record.metadata.description | nl2br"
></div>
}
{{ record.metadata.start_date | dateTranslate: 'mediumDate' }}
- {{ record.metadata.end_date | dateTranslate: 'mediumDate' }}
</div>
</h5>
@if (record.metadata.teachers) {
<div id="collection-teacher">
@for (teacher of record.metadata.teachers; track teacher; let last = $last) {
{{ teacher.name }} {{ last ? '' : ', ' }}
}
</div>
}
@if (record.metadata.description) {
<div
id="collection-start-end-date"
[innerHtml]="record.metadata.description | nl2br"
></div>
}
<div>
{{ record.metadata.start_date | dateTranslate: 'mediumDate' }}
- {{ record.metadata.end_date | dateTranslate: 'mediumDate' }}
</div>
</div>
`
})
export class CollectionBriefViewComponent implements ResultItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,67 +15,65 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
@if (record) {
<h1 id="collection-title" class="mb-3 mr-2">{{ record.metadata.title }}</h1>
@if (record.metadata.subjects) {
<section class="mt-2" id="subject">
@for(subject of record.metadata.subjects; track subject) {
<span class="badge badge-secondary mr-1 ng-star-inserted">
<i class="fa fa-tag"></i> {{ subject.name }}
</span>
}
</section>
}
<section class="mt-2" id="collection">
<dl class="row">
<section class="flex flex-column py-2 gap-2">
<h1 id="collection-title">{{ record.metadata.title }}</h1>
@if (record.metadata.subjects) {
<div id="subject" class="flex gap-1">
@for(subject of record.metadata.subjects; track subject) {
<p-tag severity="secondary">
<i class="fa fa-tag"></i>&nbsp;{{ subject.name }}
</p-tag>
}
</div>
}
<dl class="metadata">
@if (record.metadata.description) {
<dt class="col-3 py-0 label-title" translate>Description</dt>
<dd class="col-9 py-0 mb-0" [innerHtml]="record.metadata.description | nl2br"></dd>
<dt translate>Description</dt>
<dd [innerHtml]="record.metadata.description | nl2br"></dd>
}
@if (record.metadata.teachers) {
<dt class="col-3 py-0 label-title" translate>Teachers</dt>
<dd class="col-9 py-0 mb-0">
<dt translate>Teachers</dt>
<dd>
@for (teacher of record.metadata.teachers; track teacher; let last = $last) {
{{ teacher.name }} {{ last ? '' : ', ' }}
}
</dd>
}
@if (record.metadata.collection_id) {
<dt class="col-3 py-0 label-title" translate>Collection ID</dt>
<dd class="col-9 py-0 mb-0">{{ record.metadata.collection_id }}</dd>
<dt translate>Collection ID</dt>
<dd>{{ record.metadata.collection_id }}</dd>
}
@if (record.metadata.collection_type) {
<dt class="col-3 py-0 label-title" translate>Type</dt>
<dd class="col-9 py-0 mb-0">{{ record.metadata.collection_type }}</dd>
<dt translate>Type</dt>
<dd>{{ record.metadata.collection_type }}</dd>
}
@if (record.metadata.libraries) {
<dt class="col-3 py-0 label-title" translate>Libraries</dt>
<dd class="col-9 py-0 mb-0">
<ul class="list-unstyled mb-0">
<dt translate>Libraries</dt>
<dd>
<ul class="list-none m-0 p-0">
@for (library of record.metadata.libraries; track library; let last=$last) {
<li>{{ library.pid | getRecord: 'libraries' : 'field' : 'name' | async }}</li>
}
</ul>
</dd>
}
<dt class="col-3 py-0 label-title" translate>Date</dt>
<dd class="col-9 py-0 mb-0">
<dt translate>Date</dt>
<dd>
{{ record.metadata.start_date | dateTranslate: 'mediumDate' }}
- {{ record.metadata.end_date | dateTranslate: 'mediumDate' }}
</dd>
<dt class="col-3 py-0 label-title" translate>Status</dt>
<dd class="col-9 py-0 mb-0">
<i class="fa fa-circle mr-1 text-{{ record.metadata.published ? 'success' : 'danger' }}" aria-hidden="true"></i>
<dt translate>Status</dt>
<dd>
<i class="fa fa-circle mr-1" aria-hidden="true" [ngClass]="{'text-success': record.metadata.published, 'text-error': !record.metadata.published}"></i>
@if (record.metadata.published) {
{{ 'published' | translate }}
} @else {
{{ 'unpublished' | translate }}
}
</dd>
</dl>
</section>

<section id="items">
<admin-collection-items [items]="record.metadata.items"></admin-collection-items>
<admin-collection-items [items]="record.metadata.items" />
</section>
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,42 @@
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/>.
-->
<h3 class="mt-4 mb-2" translate>Items</h3>
@if (items) {
<ul class="list-unstyled">
@for (item of items; track item; let isOdd=$odd) {
<li class="py-2 px-2" [ngClass]="{ 'bg-light': isOdd }" *ngVar="item.pid | getRecord: 'items' | async as itemData">
<h3 translate class="mt-4">Items</h3>
<ul class="list-none p-0 m-0 alternate-color">
@for (item of items; track item) {
<li class="p-2" *ngVar="item.pid | getRecord: 'items' | async as itemData">
@if ($any(itemData).metadata.document.pid | getRecord:'documents':'object':null:{Accept: 'application/rero+json'} | async; as document) {
<h5>
<a [routerLink]="['/records','documents', 'detail', itemData.metadata.document.pid]">
{{ $any(document).metadata.title[0]._text }}
</a>
</h5>
<div class="my-2">
<div>
@if ($any(document).metadata.contribution) {
<shared-contribution [contributions]="$any(document).metadata.contribution"></shared-contribution>
}
</div>
<dl class="row">
<dt class="col-2 py-0 label-title" translate>Publication</dt>
<dd class="col-10 py-0 mb-0">
<dl class="metadata">
<dt translate>Publication</dt>
<dd>
{{ $any(document).metadata.provisionActivity[0]._text[0].value }}
</dd>
<dt class="col-2 py-0 label-title" translate>Barcode</dt>
<dd class="col-10 py-0 mb-0">
<dt translate>Barcode</dt>
<dd>
{{ itemData.metadata.barcode }}
</dd>
@if (itemData | itemHoldingsCallNumber | async; as callNumber) {
@if ((callNumber.first | json) !== '{}' || (callNumber.second | json) !== '{}') {
<dt class="col-2 py-0 label-title" translate>Call number</dt>
<dd class="col-10 py-0 mb-0">
<shared-inherited-call-number [item]="itemData"></shared-inherited-call-number>
<dt translate>Call number</dt>
<dd>
<shared-inherited-call-number [item]="itemData" />
</dd>
}
}
@if (itemData.metadata.location.pid | getRecord:'locations' | async; as location) {
<dt class="col-2 py-0 label-title" translate>Library</dt>
<dd class="col-10 py-0 mb-0">
<dt translate>Library</dt>
<dd>
@if ($any(location).metadata.library.pid | getRecord: 'libraries' | async; as library) {
{{ $any(library).metadata.name }} - {{ $any(location).metadata.name }}
}
Expand Down

0 comments on commit b6a0329

Please sign in to comment.