From 6fef162720a1185a608d9b7bdaa2e8bf7959bb8c Mon Sep 17 00:00:00 2001 From: Alicia Zangger Date: Tue, 12 Jan 2021 15:21:07 +0100 Subject: [PATCH] document: implement types field * Updates 'types' field according to new transformation. * Improves elements alignment in document brief and detailed views. Co-Authored-by: Alicia Zangger --- .../documents-brief-view.component.html | 3 +- .../document-detail-view.component.html | 40 ++++++++----------- projects/admin/src/app/routes/items-route.ts | 3 +- .../document-brief.component.html | 3 +- .../view/thumbnail/thumbnail.component.html | 11 ++++- .../view/thumbnail/thumbnail.component.scss | 8 ++-- .../lib/view/thumbnail/thumbnail.component.ts | 15 ++++--- 7 files changed, 46 insertions(+), 37 deletions(-) diff --git a/projects/admin/src/app/record/brief-view/documents-brief-view/documents-brief-view.component.html b/projects/admin/src/app/record/brief-view/documents-brief-view/documents-brief-view.component.html index a97bd3608..23a2735e4 100644 --- a/projects/admin/src/app/record/brief-view/documents-brief-view/documents-brief-view.component.html +++ b/projects/admin/src/app/record/brief-view/documents-brief-view/documents-brief-view.component.html @@ -17,6 +17,7 @@
@@ -32,7 +33,7 @@
{{ record.metadata.title | mainTitle }} - – {{ record.metadata.type | translate }}
+
    diff --git a/projects/admin/src/app/record/detail-view/document-detail-view/document-detail-view.component.html b/projects/admin/src/app/record/detail-view/document-detail-view/document-detail-view.component.html index f42dab680..417e79770 100644 --- a/projects/admin/src/app/record/detail-view/document-detail-view/document-detail-view.component.html +++ b/projects/admin/src/app/record/detail-view/document-detail-view/document-detail-view.component.html @@ -1,42 +1,38 @@
    Import + [queryParams]="{source: source, pid: pid}" + class="btn btn-sm btn-outline-primary" + translate>Import
    Duplicate + [queryParams]="{type: 'documents', pid: record.metadata.pid}" + class="btn btn-sm btn-outline-primary" + translate>Duplicate
    -
    +
    -
    +

    {{ altgr_title }}

- - -
    -
  • - {{ value }} -
  • -
-
+ + +
    +
  • + {{ value }} +
  • +
+
@@ -443,7 +439,6 @@

{{ altgr_title }}

- {{ altgr_title }} - diff --git a/projects/admin/src/app/routes/items-route.ts b/projects/admin/src/app/routes/items-route.ts index 1ece6b432..57cf8d1f7 100644 --- a/projects/admin/src/app/routes/items-route.ts +++ b/projects/admin/src/app/routes/items-route.ts @@ -125,12 +125,13 @@ export class ItemsRoute extends BaseRoute implements RouteInterface { redirectUrl: (record: any) => this.getUrl(record), aggregationsBucketSize: 10, aggregationsOrder: [ + 'document_type', 'library', 'location', 'item_type', 'status', ], - aggregationsExpand: ['library', 'location', 'item_type', 'status'], + aggregationsExpand: ['document_type', 'library', 'location', 'item_type', 'status'], listHeaders: { Accept: 'application/rero+json, application/json' }, diff --git a/projects/public-search/src/app/document-brief/document-brief.component.html b/projects/public-search/src/app/document-brief/document-brief.component.html index aea420a1e..b54cee4fb 100644 --- a/projects/public-search/src/app/document-brief/document-brief.component.html +++ b/projects/public-search/src/app/document-brief/document-brief.component.html @@ -17,8 +17,9 @@
+ isSmall="true">

diff --git a/projects/shared/src/lib/view/thumbnail/thumbnail.component.html b/projects/shared/src/lib/view/thumbnail/thumbnail.component.html index 1d4cd8690..76a550735 100644 --- a/projects/shared/src/lib/view/thumbnail/thumbnail.component.html +++ b/projects/shared/src/lib/view/thumbnail/thumbnail.component.html @@ -16,7 +16,7 @@ --> -
+
@@ -24,7 +24,14 @@ -
{{ record.metadata.type }}
+ + +
{{ type.subtype }}
+
+ +
{{ type.main_type }}
+
+
diff --git a/projects/shared/src/lib/view/thumbnail/thumbnail.component.scss b/projects/shared/src/lib/view/thumbnail/thumbnail.component.scss index 2f50e392c..16fa71355 100644 --- a/projects/shared/src/lib/view/thumbnail/thumbnail.component.scss +++ b/projects/shared/src/lib/view/thumbnail/thumbnail.component.scss @@ -18,10 +18,10 @@ .thumb-brief img { max-height: 122px; - width: 80px; + max-width: 80px; } -@media (max-width: 960px) { +@media (max-width: 768px) { .thumb-brief img { max-width: 48px; @@ -31,10 +31,10 @@ img { .thumb-detail img { max-height: 244px; - width: 160px; + max-width: 160px; } -@media (max-width: 960px) { +@media (max-width: 768px) { .thumb-detail img { max-width: 48px; diff --git a/projects/shared/src/lib/view/thumbnail/thumbnail.component.ts b/projects/shared/src/lib/view/thumbnail/thumbnail.component.ts index 4bad34af9..4ea9d36d8 100644 --- a/projects/shared/src/lib/view/thumbnail/thumbnail.component.ts +++ b/projects/shared/src/lib/view/thumbnail/thumbnail.component.ts @@ -35,7 +35,7 @@ export class ThumbnailComponent implements OnInit { isbn: string; /** Css classes for the image */ - imageCssClass = 'img-responsive img-thumbnail border border-light'; + imageCssClass = 'img-thumbnail img-fluid border border-light'; /** Style for image container */ figureStyle = 'thumb-detail'; @@ -66,7 +66,7 @@ export class ThumbnailComponent implements OnInit { } }) ).subscribe(result => { - if (result.success) { + if (result !== null && result.success) { this.coverUrl = result.image; } }); @@ -78,9 +78,14 @@ export class ThumbnailComponent implements OnInit { */ ngOnInit() { if (this.record && this.record.metadata) { - this.coverUrl = `/static/images/icon_${this.record.metadata.type}.png`; - if (this.record.metadata.cover_art) { - this.coverUrl = this.record.metadata.cover_art; + this.coverUrl = `/static/images/icon_${this.record.metadata.type[0].main_type}.svg`; + if (this.record.metadata.electronicLocator) { + for (const electronicLocator of this.record.metadata.electronicLocator) { + if (electronicLocator.content === 'coverImage' && electronicLocator.type === 'relatedResource') { + this.coverUrl = electronicLocator.url; + break; + } + } } else if (this.record.metadata.identifiedBy) { for (const identifier of this.record.metadata.identifiedBy) { if (identifier.type === 'bf:Isbn') {