From 74be601bb0bc7475199518c1548438a81f93c580 Mon Sep 17 00:00:00 2001 From: 178Pelado Date: Fri, 4 Oct 2024 09:19:09 -0300 Subject: [PATCH] =?UTF-8?q?11008=20Primera=20versi=C3=B3n=20vista=20del=20?= =?UTF-8?q?=C3=ADtem;=20cambio=20tama=C3=B1o=20font-size-base?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metadata-field-wrapper.component.html | 7 - .../metadata-field-wrapper.component.ts | 8 +- .../access-status-badge.component.ts | 14 +- src/app/shared/utils/persistent.identifier.ts | 68 ++++ src/styles/_bootstrap_variables.scss | 2 +- src/styles/_custom_variables.scss | 2 +- .../breadcrumbs/breadcrumbs.component.html | 20 ++ .../breadcrumbs/breadcrumbs.component.scss | 38 +++ .../app/breadcrumbs/breadcrumbs.component.ts | 8 +- .../badge-metadata-values.component.html | 31 +- .../badge-metadata-values.component.ts | 1 + .../sedici-date-metadata-values.component.ts | 4 +- ...dici-language-metadata-values.component.ts | 2 +- .../item-page-identifier.other-field.html | 7 + .../item-page-identifier.other-field.ts | 52 +++ .../item-page/simple/item-page.component.html | 15 + .../item-page/simple/item-page.component.ts | 8 +- .../untyped-item/apa-citation.component.html | 11 +- .../untyped-item/apa-citation.component.scss | 33 +- .../untyped-item/apa-citation.component.ts | 76 ++--- .../untyped-item/content-files.component.html | 21 +- .../untyped-item/content-files.component.scss | 29 +- .../untyped-item/content-files.component.ts | 30 +- .../untyped-item/full-item.component.html | 46 +-- .../untyped-item/full-item.component.ts | 8 +- .../language-switcher.component.html | 10 +- .../language-switcher.component.ts | 20 +- .../sedici-file-download-link.component.html | 4 +- .../sedici-file-download-link.component.scss | 12 +- .../sedici-file-download-link.component.ts | 4 + ...i-truncatable-generic-item-page-field.html | 11 + ...i-truncatable-generic-item-page-field.scss | 4 + ...ici-truncatable-generic-item-page-field.ts | 54 +++ .../tabbed-content.component.html | 3 + .../tabbed-content.component.scss | 1 - .../untyped-item/tabbed-content.component.ts | 10 +- .../untyped-item/untyped-item.component.html | 314 +++++++----------- .../untyped-item/untyped-item.component.scss | 19 +- .../untyped-item/untyped-item.component.ts | 86 +---- .../access-status-badge.component.ts | 57 +++- .../sedici-context-badge.component.scss | 2 +- .../sedici-context-badge.component.ts | 74 +++-- 42 files changed, 705 insertions(+), 521 deletions(-) create mode 100644 src/app/shared/utils/persistent.identifier.ts create mode 100644 src/themes/custom/app/item-page/simple/field-components/specific-field/identfier-other/item-page-identifier.other-field.html create mode 100644 src/themes/custom/app/item-page/simple/field-components/specific-field/identfier-other/item-page-identifier.other-field.ts create mode 100644 src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-truncatable-generic-item-page-field.html create mode 100644 src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-truncatable-generic-item-page-field.scss create mode 100644 src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-truncatable-generic-item-page-field.ts diff --git a/src/app/shared/metadata-field-wrapper/metadata-field-wrapper.component.html b/src/app/shared/metadata-field-wrapper/metadata-field-wrapper.component.html index 826091aebc8..a5b9f9851d8 100644 --- a/src/app/shared/metadata-field-wrapper/metadata-field-wrapper.component.html +++ b/src/app/shared/metadata-field-wrapper/metadata-field-wrapper.component.html @@ -1,10 +1,3 @@ - -
{{ label }}
diff --git a/src/app/shared/metadata-field-wrapper/metadata-field-wrapper.component.ts b/src/app/shared/metadata-field-wrapper/metadata-field-wrapper.component.ts index e4548e2e24a..fae5b6f6b39 100644 --- a/src/app/shared/metadata-field-wrapper/metadata-field-wrapper.component.ts +++ b/src/app/shared/metadata-field-wrapper/metadata-field-wrapper.component.ts @@ -24,11 +24,5 @@ export class MetadataFieldWrapperComponent { @Input() hideIfNoTextContent = true; - @Input() inlineLabel: boolean; - - ngOnInit() { - if (this.inlineLabel === undefined) { - this.inlineLabel = true; - } - } + @Input() inlineLabel: boolean = true; } diff --git a/src/app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component.ts b/src/app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component.ts index 668a0fc945b..9a84ce9df27 100644 --- a/src/app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component.ts +++ b/src/app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component.ts @@ -24,7 +24,6 @@ import { Item } from '../../../../../core/shared/item.model'; import { ITEM } from '../../../../../core/shared/item.resource-type'; import { hasValue } from '../../../../empty.util'; import { AccessStatusObject } from './access-status.model'; -import { RemoteData } from 'src/app/core/data/remote-data'; @Component({ selector: 'ds-base-access-status-badge', @@ -61,7 +60,7 @@ export class AccessStatusBadgeComponent { * * @param {AccessStatusDataService} accessStatusDataService */ - constructor(private accessStatusDataService: AccessStatusDataService) { } + constructor(protected accessStatusDataService: AccessStatusDataService) { } ngOnInit(): void { this.showAccessStatus = environment.item.showAccessStatuses; @@ -71,17 +70,12 @@ export class AccessStatusBadgeComponent { } const item = this.object as Item; - let accessStatus$; - if (item.accessStatus == null) { // In case the access status has not been loaded, do it individually. - accessStatus$ = this.accessStatusDataService.findAccessStatusFor(item); - } else { - accessStatus$ = item.accessStatus; + item.accessStatus = this.accessStatusDataService.findAccessStatusFor(item); } - - this.accessStatus$ = accessStatus$.pipe( - map((accessStatusRD: RemoteData) => { + this.accessStatus$ = item.accessStatus.pipe( + map((accessStatusRD) => { if (accessStatusRD.statusCode !== 401 && hasValue(accessStatusRD.payload)) { return accessStatusRD.payload; } else { diff --git a/src/app/shared/utils/persistent.identifier.ts b/src/app/shared/utils/persistent.identifier.ts new file mode 100644 index 00000000000..23c5a0551c0 --- /dev/null +++ b/src/app/shared/utils/persistent.identifier.ts @@ -0,0 +1,68 @@ +import { MetadataValue } from 'src/app/core/shared/metadata.models'; +import { Item } from 'src/app/core/shared/item.model'; + +// Métodos para obtener los valores de url y urn de ['dc.identifier.uri', 'sedici.identifier.other'] +export function extractSuffix(identifier: string, prefixes: string[]): string { + for (const prefix of prefixes) { + const index = identifier.indexOf(prefix); + if (index !== -1) { + return identifier.substring(index + prefix.length).trim(); + } + } + return identifier; +} + +export function setUrl(urlBase: string, suffix: string): string { + return urlBase + suffix; +} + +export function setPersistentIdentifiers(object: Item, identifierOtherMetadataName: string[]): { mdValue: MetadataValue, label: string, url: string }[] { + let itemIdentifiers = []; + object.allMetadata(identifierOtherMetadataName).forEach( + (mdValue, index) => { + const identifierValue = mdValue.value.toLowerCase(); + let label = ''; + let url = ''; + let urn = ''; + let urlBase = ''; + + if (identifierValue.includes('doi') || identifierValue.startsWith('10.')) { + label = 'DOI'; + urn = extractSuffix(mdValue.value, ['https://doi.org/', 'http://dx.doi.org/', 'doi:', 'DOI:']); + urlBase = 'https://doi.org/'; + } else if (identifierValue.includes('hdl') || identifierValue.includes('handle')) { + label = 'HDL'; + urn = extractSuffix(mdValue.value, ['http://hdl.handle.net/', 'hdl:', '/handle/']); + urlBase = 'http://hdl.handle.net/'; + } else if (identifierValue.includes('arxiv')) { + label = 'arXiv'; + urn = extractSuffix(mdValue.value, ['/arxiv.org/abs/', '/arxiv.org/pdf/', '/archive.org/details/arxiv-', 'arxiv:', 'arXiv:']); + urlBase = 'https://arxiv.org/abs/'; + } else if (identifierValue.includes('pmcid') || identifierValue.includes('pmid')) { + label = 'PubMed'; + urn = extractSuffix(mdValue.value, ['pmid:', 'pmcid:']); + urlBase = urn.startsWith('PMC') ? 'https://www.ncbi.nlm.nih.gov/pmc/articles/' : 'https://pubmed.ncbi.nlm.nih.gov/'; + } else if (identifierValue.includes('ark')) { + label = 'ARK'; + urn = extractSuffix(mdValue.value, ['ark:']); + urlBase = 'https://n2t.net/ark:/'; // VER + } else { + return; + } + + if (identifierValue.startsWith('http')) { + url = identifierValue; + } else { + url = setUrl(urlBase, urn); + } + + const identifierListLength = itemIdentifiers.push({ + mdValue: new MetadataValue(), + label: label, + url: url, + }); + itemIdentifiers[identifierListLength - 1].mdValue.value = urn; + } + ); + return itemIdentifiers; +} \ No newline at end of file diff --git a/src/styles/_bootstrap_variables.scss b/src/styles/_bootstrap_variables.scss index 386b4b47fe3..d80b53ea088 100644 --- a/src/styles/_bootstrap_variables.scss +++ b/src/styles/_bootstrap_variables.scss @@ -15,7 +15,7 @@ /*** FONT FAMILIES AND FONT SIZES ***/ -$font-size-base: 1rem !default; // Assumes the browser default, typically `16px` +$font-size-base: 0.9rem !default; // Assumes the browser default, typically `16px` $h1-font-size: $font-size-base * 2.125 !default; $h2-font-size: $font-size-base * 1.75 !default; $h3-font-size: $font-size-base * 1.5 !default; diff --git a/src/styles/_custom_variables.scss b/src/styles/_custom_variables.scss index f261f0f400a..6796e73f2f4 100644 --- a/src/styles/_custom_variables.scss +++ b/src/styles/_custom_variables.scss @@ -105,7 +105,7 @@ --ds-breadcrumb-bg: #{$gray-200} !important; --ds-breadcrumb-link-color: #{$ds-breadcrumb-link-color}; --ds-breadcrumb-link-active-color: #{darken($ds-breadcrumb-link-color, 30%)}; - --ds-breadcrumb-max-length: 200px; + --ds-breadcrumb-max-length: 300px; --ds-slider-color: #{$ds-slider-color}; --ds-slider-handle-width: 18px; diff --git a/src/themes/custom/app/breadcrumbs/breadcrumbs.component.html b/src/themes/custom/app/breadcrumbs/breadcrumbs.component.html index e69de29bb2d..acab8ab95b4 100644 --- a/src/themes/custom/app/breadcrumbs/breadcrumbs.component.html +++ b/src/themes/custom/app/breadcrumbs/breadcrumbs.component.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + diff --git a/src/themes/custom/app/breadcrumbs/breadcrumbs.component.scss b/src/themes/custom/app/breadcrumbs/breadcrumbs.component.scss index e69de29bb2d..a0b9550b1d6 100644 --- a/src/themes/custom/app/breadcrumbs/breadcrumbs.component.scss +++ b/src/themes/custom/app/breadcrumbs/breadcrumbs.component.scss @@ -0,0 +1,38 @@ +.nav-breadcrumb { + background-color: var(--ds-breadcrumb-bg); +} + +.breadcrumb { + border-radius: 0; + padding-bottom: calc(var(--ds-content-spacing) / 2); + padding-top: calc(var(--ds-content-spacing) / 2); + background-color: var(--ds-breadcrumb-bg); +} + +li.breadcrumb-item { + display: flex; +} + +.breadcrumb-item-limiter { + display: inline-block; + max-width: var(--ds-breadcrumb-max-length); + > * { + max-width: 100%; + display: block; + } +} + +li.breadcrumb-item { + a { + color: var(--ds-breadcrumb-link-color); + } +} + +li.breadcrumb-item.active { + color: var(--ds-breadcrumb-link-active-color); +} + +.breadcrumb-item+ .breadcrumb-item::before { + display: block; + content: quote(">") !important; +} diff --git a/src/themes/custom/app/breadcrumbs/breadcrumbs.component.ts b/src/themes/custom/app/breadcrumbs/breadcrumbs.component.ts index c71caf9f023..b4f72f32afc 100644 --- a/src/themes/custom/app/breadcrumbs/breadcrumbs.component.ts +++ b/src/themes/custom/app/breadcrumbs/breadcrumbs.component.ts @@ -17,10 +17,10 @@ import { VarDirective } from '../../../../app/shared/utils/var.directive'; */ @Component({ selector: 'ds-themed-breadcrumbs', - // templateUrl: './breadcrumbs.component.html', - templateUrl: '../../../../app/breadcrumbs/breadcrumbs.component.html', - // styleUrls: ['./breadcrumbs.component.scss'] - styleUrls: ['../../../../app/breadcrumbs/breadcrumbs.component.scss'], + templateUrl: './breadcrumbs.component.html', + // templateUrl: '../../../../app/breadcrumbs/breadcrumbs.component.html', + styleUrls: ['./breadcrumbs.component.scss'], + // styleUrls: ['../../../../app/breadcrumbs/breadcrumbs.component.scss'], standalone: true, imports: [VarDirective, NgIf, NgTemplateOutlet, NgFor, RouterLink, NgbTooltipModule, AsyncPipe, TranslateModule], }) diff --git a/src/themes/custom/app/item-page/simple/field-components/badge-metadata-values/badge-metadata-values.component.html b/src/themes/custom/app/item-page/simple/field-components/badge-metadata-values/badge-metadata-values.component.html index 4efbb6e3824..e94183991cb 100644 --- a/src/themes/custom/app/item-page/simple/field-components/badge-metadata-values/badge-metadata-values.component.html +++ b/src/themes/custom/app/item-page/simple/field-components/badge-metadata-values/badge-metadata-values.component.html @@ -1,21 +1,22 @@ - - - + + + -
- - {{badgeLabel}} - - - {{mdValue.value}} - - {{mdValue.value}} - - - -
+
+ + {{badgeLabel}} + + + {{ mdValue.value }} + {{ mdValue.value }} + + {{mdValue.value}} + + + +
diff --git a/src/themes/custom/app/item-page/simple/field-components/badge-metadata-values/badge-metadata-values.component.ts b/src/themes/custom/app/item-page/simple/field-components/badge-metadata-values/badge-metadata-values.component.ts index 2b211a13834..fdba85e4bab 100644 --- a/src/themes/custom/app/item-page/simple/field-components/badge-metadata-values/badge-metadata-values.component.ts +++ b/src/themes/custom/app/item-page/simple/field-components/badge-metadata-values/badge-metadata-values.component.ts @@ -17,6 +17,7 @@ export class BadgeMetadataValuesComponent extends MetadataValuesComponent { @Input() badgeLabel: string; @Input() badgeLabelType: string; @Input() copyToClipboardButton: boolean = false; + @Input() url: string; copyToClipboard(el: HTMLDivElement, id: string) { if (navigator.clipboard) { diff --git a/src/themes/custom/app/item-page/simple/field-components/date-metadata-values/sedici-date-metadata-values.component.ts b/src/themes/custom/app/item-page/simple/field-components/date-metadata-values/sedici-date-metadata-values.component.ts index 11bdda8daa8..5934e092f01 100644 --- a/src/themes/custom/app/item-page/simple/field-components/date-metadata-values/sedici-date-metadata-values.component.ts +++ b/src/themes/custom/app/item-page/simple/field-components/date-metadata-values/sedici-date-metadata-values.component.ts @@ -18,13 +18,13 @@ import { TranslateModule } from '@ngx-translate/core'; ], }) export class SediciDateMetadataValuesComponent extends MetadataValuesComponent implements OnInit { - @Input() inlineLabel: boolean; + @Input() inlineLabel: boolean = true; dateString: string; ngOnInit(): void { const date = this.mdValues?.[0]?.value; if (date !== undefined) { - if (date.length === 10) { + if (date.length === 10 || date.includes('T')) { this.dateString = new Date(date).toLocaleDateString('es-AR',{ year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' }); } else if (date.length === 7) { this.dateString = new Date(date).toLocaleDateString('es-AR',{ year: 'numeric', month: 'long', timeZone: 'UTC' }); diff --git a/src/themes/custom/app/item-page/simple/field-components/language-metadata-values/sedici-language-metadata-values.component.ts b/src/themes/custom/app/item-page/simple/field-components/language-metadata-values/sedici-language-metadata-values.component.ts index c085ddf72b5..64483039565 100644 --- a/src/themes/custom/app/item-page/simple/field-components/language-metadata-values/sedici-language-metadata-values.component.ts +++ b/src/themes/custom/app/item-page/simple/field-components/language-metadata-values/sedici-language-metadata-values.component.ts @@ -18,7 +18,7 @@ import { TranslateModule } from '@ngx-translate/core'; ], }) export class SediciLanguageMetadataValuesComponent extends MetadataValuesComponent implements OnInit { - @Input() inlineLabel: boolean; + @Input() inlineLabel: boolean = true; languageString: string; ngOnInit(): void { diff --git a/src/themes/custom/app/item-page/simple/field-components/specific-field/identfier-other/item-page-identifier.other-field.html b/src/themes/custom/app/item-page/simple/field-components/specific-field/identfier-other/item-page-identifier.other-field.html new file mode 100644 index 00000000000..934552f4937 --- /dev/null +++ b/src/themes/custom/app/item-page/simple/field-components/specific-field/identfier-other/item-page-identifier.other-field.html @@ -0,0 +1,7 @@ +
+ +
\ No newline at end of file diff --git a/src/themes/custom/app/item-page/simple/field-components/specific-field/identfier-other/item-page-identifier.other-field.ts b/src/themes/custom/app/item-page/simple/field-components/specific-field/identfier-other/item-page-identifier.other-field.ts new file mode 100644 index 00000000000..c76d04ae996 --- /dev/null +++ b/src/themes/custom/app/item-page/simple/field-components/specific-field/identfier-other/item-page-identifier.other-field.ts @@ -0,0 +1,52 @@ +import { + Component, + Input, +} from '@angular/core'; + +import { Item } from 'src/app/core/shared/item.model'; +import { MetadataValuesComponent } from 'src/app/item-page/field-components/metadata-values/metadata-values.component'; +import { MetadataValue } from 'src/app/core/shared/metadata.models'; + +@Component({ + selector: 'ds-item-page-identifier-other-field', + templateUrl: './item-page-identifier.other-field.html', + standalone: true, + imports: [MetadataValuesComponent], +}) + +export class ItemPageIdentifierOtherFieldComponent{ + + /** + * The item to display metadata for + */ + @Input() item: Item; + + /** + * Fields (schema.element.qualifier) used to render their values. + */ + fields: string[] = ['sedici.identifier.other']; + + /** + * Label i18n key for the rendered metadata + */ + label: string = 'Otros idenfiticadores'; + + /** + * Separator string between multiple values of the metadata fields defined + * @type {string} + */ + separator = '
'; + + mdValues: MetadataValue[]; + + ngOnInit() { + this.selectNotPersistentIdentifiers(); + } + + selectNotPersistentIdentifiers(): void { + const persistentIdentifiers = ['doi', 'DOI', 'handle', 'hdl', 'arxiv', 'arXiv', 'pmcid', 'pmid', 'ark']; + this.mdValues = this.item.allMetadata(this.fields).filter(mdValue => { + return !persistentIdentifiers.some(identifier => mdValue.value.includes(identifier)); + }); + } +} diff --git a/src/themes/custom/app/item-page/simple/item-page.component.html b/src/themes/custom/app/item-page/simple/item-page.component.html index e69de29bb2d..0603a37983f 100644 --- a/src/themes/custom/app/item-page/simple/item-page.component.html +++ b/src/themes/custom/app/item-page/simple/item-page.component.html @@ -0,0 +1,15 @@ +
+
+
+ + + + + + + +
+
+ + +
diff --git a/src/themes/custom/app/item-page/simple/item-page.component.ts b/src/themes/custom/app/item-page/simple/item-page.component.ts index 7daa65287a5..90efde101e5 100644 --- a/src/themes/custom/app/item-page/simple/item-page.component.ts +++ b/src/themes/custom/app/item-page/simple/item-page.component.ts @@ -28,10 +28,10 @@ import { ViewTrackerComponent } from '../../../../../app/statistics/angulartics/ */ @Component({ selector: 'ds-themed-item-page', - // styleUrls: ['./item-page.component.scss'], - styleUrls: ['../../../../../app/item-page/simple/item-page.component.scss'], - // templateUrl: './item-page.component.html', - templateUrl: '../../../../../app/item-page/simple/item-page.component.html', + styleUrls: ['./item-page.component.scss'], + // styleUrls: ['../../../../../app/item-page/simple/item-page.component.scss'], + templateUrl: './item-page.component.html', + // templateUrl: '../../../../../app/item-page/simple/item-page.component.html', changeDetection: ChangeDetectionStrategy.OnPush, animations: [fadeInOut], standalone: true, diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/apa-citation.component.html b/src/themes/custom/app/item-page/simple/item-types/untyped-item/apa-citation.component.html index 7a1421effd8..d0b7f359442 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/apa-citation.component.html +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/apa-citation.component.html @@ -1,7 +1,10 @@ -
-
- -
+
+ + +
+
{{ citation }}
diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/apa-citation.component.scss b/src/themes/custom/app/item-page/simple/item-types/untyped-item/apa-citation.component.scss index 630bb5d0292..6772bdafcf4 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/apa-citation.component.scss +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/apa-citation.component.scss @@ -4,18 +4,9 @@ border-radius: 5px; background-color: #f9f9f9; font-family: Arial, sans-serif; - max-width: 300px; - max-height: 200px; // Tamaño máximo de la caja - overflow: hidden; // Ocultar el contenido que se desborda - transition: max-height 0.3s ease; // Transición para el cambio de tamaño - - &.expanded { - max-height: none; // Permitir que la caja se expanda completamente - } } .apa-citation { - font-size: 14px; color: #333333; line-height: 1.5; font-style: italic; @@ -24,9 +15,9 @@ .copy-button-container { display: flex; - justify-content: space-between; - align-items: center; - padding-top: 5px; + justify-content: flex-end; + padding-top: .25rem; + gap: .25rem; } .copy-text { @@ -36,27 +27,11 @@ .copyButton { cursor: pointer; - font-size: 16px; + font-size: 1rem; color: #333333; transition: color 0.3s; } .copyButton:hover { color: #007bff; -} - -.toggle-button-container { - display: flex; - justify-content: right; -} - -.toggleButton { - cursor: pointer; - font-size: 16px; - color: #333333; - transition: color 0.3s; -} - -.toggleButton:hover { - color: #007bff; } \ No newline at end of file diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/apa-citation.component.ts b/src/themes/custom/app/item-page/simple/item-types/untyped-item/apa-citation.component.ts index 01322d60b4a..0e5f3dd8b75 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/apa-citation.component.ts +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/apa-citation.component.ts @@ -12,57 +12,32 @@ export class ApaCitationComponent implements OnInit { @Input() item: any; @ViewChild('elementContentToCopy') elementContentToCopy: ElementRef; citation: string; - isExpanded: boolean = false; - showToggleButton: boolean = false; + citationType: string = 'apa'; - ngOnInit(): void { - this.generateCitation(); - } - - ngAfterViewInit(): void { - this.checkContentHeight(); - } - - generateCitation(): void { - const authors = this.getAuthors(); - const year = this.getYear(); - const title = this.getTitle(); - const journalTitle = this.getJournalTitle(); - const journalVolumeAndIssue = this.getJournalVolumeAndIssue(); - const pages = this.getPages(); - const source = this.getSource(); - - this.citation = `${authors} (${year}). ${title}. ${journalTitle}, ${journalVolumeAndIssue}, ${pages}. ${source}.`; - } - - getAuthors(): string { - const authors = this.item.allMetadata(['sedici.creator.person']); - return authors.map(author => author.value).join(', '); - } + citationOptions = [ + { value: 'apa', label: 'APA' }, + { value: 'chicago', label: 'Chicago' }, + { value: 'mla', label: 'MLA' }, + ]; - getYear(): string { - const date = this.item.firstMetadataValue('dc.date.issued'); - return date ? new Date(date).getFullYear().toString() : 's.f.'; - } - - getTitle(): string { - return this.item.firstMetadataValue('dc.title') || 'Sin título'; - } - - getJournalTitle(): string { - return this.item.firstMetadataValue('sedici.relation.journalTitle') || 'Sin journalTitle'; - } - - getJournalVolumeAndIssue(): string { - return this.item.firstMetadataValue('sedici.relation.journalVolumeAndIssue') || 'Sin journalVolumeAndIssue'; + ngOnInit(): void { + this.generateCitation(this.citationType); } - getPages(): string { - return this.item.firstMetadataValue('dc.format.extent') || 'Sin pages'; + generateCitation(type: string): void { + if (type === 'apa') { + this.citation = 'Melville, H. & Schaeffer, M. (1922) Moby Dick. New York, Dodd, Mead and company. [Pdf] Retrieved from the Library of Congress, https://www.loc.gov/item/22022440/'; + } else if (type === 'chicago') { + this.citation = 'Melville, Herman, and Mead Schaeffer. Moby Dick. New York, Dodd, Mead and company, 1922. Pdf. https://www.loc.gov/item/22022440/'; + } else { + this.citation = 'Melville, Herman, and Mead Schaeffer. Moby Dick. New York, Dodd, Mead and company, 1922. Pdf. Retrieved from the Library of Congress, '; + } } - getSource(): string { - return this.item.firstMetadataValue('dc.identifier.doi') || 'Sin fuente'; + onCitationTypeChange(event: Event): void { + const selectElement = event.target as HTMLSelectElement; + this.citationType = selectElement.value; + this.generateCitation(this.citationType); } copyToClipboard(el: HTMLDivElement, id: string) { @@ -81,15 +56,4 @@ export class ApaCitationComponent implements OnInit { console.log('Browser do not support Clipboard API'); } } - - toggleExpand(): void { - this.isExpanded = !this.isExpanded; - } - - checkContentHeight(): void { - const maxHeight = 195; // Altura máxima de la caja - if (this.elementContentToCopy.nativeElement.scrollHeight > maxHeight) { - this.showToggleButton = true; - } - } } \ No newline at end of file diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/content-files.component.html b/src/themes/custom/app/item-page/simple/item-types/untyped-item/content-files.component.html index c16172a4028..ca17986d71f 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/content-files.component.html +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/content-files.component.html @@ -1,14 +1,13 @@
-
+
-
- .{{ getFileExtension(file.name) }} +
+ {{ getFileExtension(file.name) }}
- {{ getFileDescription(file) }} - {{ (file?.sizeBytes) | dsFileSize }} -
+ {{ getFileDescription(file) }} +
@@ -16,11 +15,15 @@
-
+
- - SOY UNA IMAGEN +
+ {{ dsoNameService.getName(selectedFile) }} +
+ + SOY UNA IMAGEN {{ dsoNameService.getName(selectedFile) }} +
diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/content-files.component.scss b/src/themes/custom/app/item-page/simple/item-types/untyped-item/content-files.component.scss index 43f30a82c8d..444d7dbc8b9 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/content-files.component.scss +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/content-files.component.scss @@ -11,8 +11,12 @@ flex: 1; display: flex; flex-direction: column; - max-height: 500px; // Ajusta este valor según el tamaño del previsualizador - overflow-y: auto; // Agrega el scrollbar vertical si el contenido excede el tamaño + max-height: 500px; + overflow-y: auto; + + .row { + flex-wrap: nowrap; + } .file-item { display: flex; @@ -33,22 +37,20 @@ border-radius: 4px; .file-extension { - font-size: 10px; + font-size: .625rem; font-weight: bold; } } .file-info { - flex: 1; display: flex; flex-direction: column; .row { - display: flex; align-items: center; .file-name { - font-weight: bold; + font-size: .75rem; overflow: hidden; // Oculta el texto que se desborda text-overflow: ellipsis; // Agrega puntos suspensivos al texto que se desborda display: -webkit-box; // Necesario para line-clamp @@ -58,8 +60,8 @@ } .file-size { + font-size: .75rem; text-align: right; - font-size: 14px; } .download-btn { @@ -74,23 +76,18 @@ } } } - - .file-preview { - font-size: 12px; - color: #888; - margin-top: 5px; - } } } } .file-preview { - flex: 2; position: relative; + padding-right: 0px; + padding-left: 0px; .preview-image { width: 100%; - height: 500px; // Ajusta el tamaño según tus necesidades + height: 500px; } .no-preview { @@ -103,7 +100,7 @@ background-color: #f5f5f5; span { - font-size: 24px; + font-size: 1.5rem; color: #aaa; } } diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/content-files.component.ts b/src/themes/custom/app/item-page/simple/item-types/untyped-item/content-files.component.ts index 214e2e483d6..a787b39c779 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/content-files.component.ts +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/content-files.component.ts @@ -1,5 +1,5 @@ import { Component, Input, Inject } from '@angular/core'; -import { NgFor, NgIf } from '@angular/common'; +import { NgFor, NgIf, NgStyle } from '@angular/common'; import { Item } from 'src/app/core/shared/item.model'; import { BitstreamDataService } from 'src/app/core/data/bitstream-data.service'; import { APP_CONFIG, AppConfig } from 'src/config/app-config.interface'; @@ -16,6 +16,7 @@ import { SediciFileDownloadLinkComponent } from './sedici-file-download-link.com imports: [ NgFor, NgIf, + NgStyle, FileSizePipe, SediciFileDownloadLinkComponent, ], @@ -24,6 +25,7 @@ export class ContentFilesComponent { @Input() object: Item; primaryBitsreamId: string; + previewUrl: string; files: Bitstream[] = []; @@ -37,6 +39,7 @@ export class ContentFilesComponent { selectFile(file: Bitstream) { this.selectedFile = file; + this.previewUrl = file._links.content.href; // Solo para probar la vista de imágenes } getFileExtension(fileName: string): string { @@ -44,6 +47,31 @@ export class ContentFilesComponent { return parts.length > 1 ? parts.pop() : ''; } + stringToHexColor(str: string): string { + let hash = 0; + for (let i = 0; i < str.length; i++) { + hash += str.charCodeAt(i); + hash += (hash << 10); + hash ^= (hash >> 6); + } + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + + let color = '#'; + for (let i = 0; i < 3; i++) { + const value = (hash >> (i * 8)) & 0xFF; + color += ('00' + value.toString(16)).substr(-2); + } + return color; + } + + getBadgeStyle(fileName: string): { [key: string]: string } { + const extension = this.getFileExtension(fileName); + const color = this.stringToHexColor(extension); + return { 'background-color': color }; + } + isImage(file: Bitstream): boolean { const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp']; const extension = this.getFileExtension(file.name).toLowerCase(); diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/full-item.component.html b/src/themes/custom/app/item-page/simple/item-types/untyped-item/full-item.component.html index 58d441a78e6..a027e335ab7 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/full-item.component.html +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/full-item.component.html @@ -1,17 +1,3 @@ - -
+ + + + + + + + + + + + + [label]="'Idioma del documento'"> - - + + + +
diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/full-item.component.ts b/src/themes/custom/app/item-page/simple/item-types/untyped-item/full-item.component.ts index 582dc07efa6..032fd35fdfc 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/full-item.component.ts +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/full-item.component.ts @@ -9,7 +9,7 @@ import { GenericItemPageFieldComponent } from 'src/app/item-page/simple/field-co import { SediciDateMetadataValuesComponent } from '../../field-components/date-metadata-values/sedici-date-metadata-values.component'; import { SediciLanguageMetadataValuesComponent } from '../../field-components/language-metadata-values/sedici-language-metadata-values.component'; import { CollectionsComponent } from 'src/app/item-page/field-components/collections/collections.component'; - +import { ItemPageIdentifierOtherFieldComponent } from '../../field-components/specific-field/identfier-other/item-page-identifier.other-field'; @Component({ selector: 'full-item', // styleUrls: ['./full-item.component.scss'], @@ -23,6 +23,7 @@ import { CollectionsComponent } from 'src/app/item-page/field-components/collect SediciDateMetadataValuesComponent, SediciLanguageMetadataValuesComponent, CollectionsComponent, + ItemPageIdentifierOtherFieldComponent, ], }) export class FullItemComponent { @@ -32,9 +33,4 @@ export class FullItemComponent { ngOnInit(): void { this.itemPageRoute = getItemPageRoute(this.object); } - - getMetadataEntries() { - const metadata = this.object.metadata; - return Object.keys(metadata).map(key => ({ key, value: metadata[key] })); - } } \ No newline at end of file diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/language-switcher.component.html b/src/themes/custom/app/item-page/simple/item-types/untyped-item/language-switcher.component.html index 9e3708f95d4..88677339c83 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/language-switcher.component.html +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/language-switcher.component.html @@ -1,13 +1,13 @@ - +
- +

diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/language-switcher.component.ts b/src/themes/custom/app/item-page/simple/item-types/untyped-item/language-switcher.component.ts index 889fd9cadaa..e8b6e091b03 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/language-switcher.component.ts +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/language-switcher.component.ts @@ -1,7 +1,6 @@ import { Component, Input } from '@angular/core'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { NgIf, NgFor } from '@angular/common'; -import { MetadataFieldWrapperComponent } from 'src/app/shared/metadata-field-wrapper/metadata-field-wrapper.component'; import { TranslateModule } from '@ngx-translate/core'; import { TruncatableComponent } from 'src/app/shared/truncatable/truncatable.component'; import { TruncatablePartComponent } from 'src/app/shared/truncatable/truncatable-part/truncatable-part.component'; @@ -14,7 +13,6 @@ import { TruncatablePartComponent } from 'src/app/shared/truncatable/truncatable imports: [ NgIf, NgFor, - MetadataFieldWrapperComponent, TranslateModule, TruncatableComponent, TruncatablePartComponent, @@ -34,11 +32,15 @@ export class LanguageSwitcherComponent { getAbstract(): SafeHtml { const abstracts = this.item.metadata['dc.description.abstract']; - if (!abstracts) { - return this.sanitizer.bypassSecurityTrustHtml(''); + if (abstracts) { + let abstract = abstracts.find((abstract: any) => (abstract.language || 'es') === this.selectedLanguage)?.value || ''; + if (!abstract) { + abstract = abstracts[0].value; + this.selectedLanguage = abstracts[0].language; + } + return this.sanitizer.bypassSecurityTrustHtml(abstract); } - const abstract = abstracts.find((abstract: any) => (abstract.language || 'es') === this.selectedLanguage)?.value || ''; - return this.sanitizer.bypassSecurityTrustHtml(abstract); + return this.sanitizer.bypassSecurityTrustHtml(''); } changeLanguage(language: string) { @@ -47,9 +49,9 @@ export class LanguageSwitcherComponent { getAvailableLanguages() { const abstracts = this.item.metadata['dc.description.abstract']; - if (!abstracts) { - return []; + if (abstracts) { + return [...new Set(abstracts.map((abstract: any) => abstract.language))]; } - return [...new Set(abstracts.map((abstract: any) => abstract.language))]; + return []; } } \ No newline at end of file diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-file-download-link.component.html b/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-file-download-link.component.html index a3f6fd009d8..7c67b0a619a 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-file-download-link.component.html +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-file-download-link.component.html @@ -1,5 +1,5 @@ - \ No newline at end of file diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-file-download-link.component.scss b/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-file-download-link.component.scss index 999612ca708..cad1f3bf103 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-file-download-link.component.scss +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-file-download-link.component.scss @@ -1,20 +1,16 @@ .download-btn { background-color: #fff; border: 1px solid #ccc; - padding: 3px 8px; // Reducir el padding para achicar el botón + padding: 3px 8px; cursor: pointer; border-radius: 4px; - font-size: 14px; // Reducir el tamaño de la letra + font-size: .625rem; &:hover { background-color: #e0e0e0; } .pr-1 { - padding-right: 5px; // Ajustar el padding del icono si es necesario - } - - i { - font-size: 12px; // Ajustar el tamaño del icono si es necesario - } + padding-right: 5px; + } } \ No newline at end of file diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-file-download-link.component.ts b/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-file-download-link.component.ts index af1ac0da3b0..ea01a8a110b 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-file-download-link.component.ts +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-file-download-link.component.ts @@ -6,7 +6,9 @@ import { import { Component, OnInit } from '@angular/core'; import { RouterLink } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; +import { FileSizePipe } from 'src/app/shared/utils/file-size-pipe'; import { FileDownloadLinkComponent } from 'src/app/shared/file-download-link/file-download-link.component'; +import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; @Component({ selector: 'ds-sedici-file-download-link', @@ -19,6 +21,8 @@ import { FileDownloadLinkComponent } from 'src/app/shared/file-download-link/fil NgIf, RouterLink, TranslateModule, + FileSizePipe, + NgbTooltipModule, ], }) export class SediciFileDownloadLinkComponent extends FileDownloadLinkComponent implements OnInit { diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-truncatable-generic-item-page-field.html b/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-truncatable-generic-item-page-field.html new file mode 100644 index 00000000000..353251aa0ae --- /dev/null +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-truncatable-generic-item-page-field.html @@ -0,0 +1,11 @@ + + + + +

+
+
+
+
diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-truncatable-generic-item-page-field.scss b/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-truncatable-generic-item-page-field.scss new file mode 100644 index 00000000000..10a43730a38 --- /dev/null +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-truncatable-generic-item-page-field.scss @@ -0,0 +1,4 @@ +.text { + white-space: pre-wrap; + text-align: justify; +} \ No newline at end of file diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-truncatable-generic-item-page-field.ts b/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-truncatable-generic-item-page-field.ts new file mode 100644 index 00000000000..74956cb56f6 --- /dev/null +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/sedici-truncatable-generic-item-page-field.ts @@ -0,0 +1,54 @@ +import { Component, Input } from '@angular/core'; +import { Item } from 'src/app/core/shared/item.model'; +import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; +import { NgIf, NgFor } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { MetadataFieldWrapperComponent } from 'src/app/shared/metadata-field-wrapper/metadata-field-wrapper.component'; +import { TruncatableComponent } from 'src/app/shared/truncatable/truncatable.component'; +import { TruncatablePartComponent } from 'src/app/shared/truncatable/truncatable-part/truncatable-part.component'; + +@Component({ + selector: 'sedici-truncatable-generic-item-page-field', + styleUrls: ['./sedici-truncatable-generic-item-page-field.scss'], + templateUrl: './sedici-truncatable-generic-item-page-field.html', + standalone: true, + imports: [ + NgIf, + NgFor, + TranslateModule, + MetadataFieldWrapperComponent, + TruncatableComponent, + TruncatablePartComponent, + ], +}) +export class SediciTruncatableGenericItemPageFieldComponent { + @Input() item: Item; + @Input() fields: string[]; + @Input() label: string; + @Input() minLines: number = 4; + metadataTextValue: SafeHtml; + length: number = -1; + + constructor(private sanitizer: DomSanitizer) {} + + ngOnInit() { + this.metadataTextValue = this.getMetadataText(); + } + + getMetadataText(): SafeHtml { + let metadataArray: any[]; + metadataArray = this.item.allMetadata(this.fields); + let concat = ''; + metadataArray.forEach((metadata, index) => { + concat += metadata.value; + if (index < metadataArray.length - 1) { + concat += '\n'; + } + }); + if (concat.length > 0) { + this.length = concat.length; + return this.sanitizer.bypassSecurityTrustHtml(concat); + } + return this.sanitizer.bypassSecurityTrustHtml(''); + } +} \ No newline at end of file diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/tabbed-content.component.html b/src/themes/custom/app/item-page/simple/item-types/untyped-item/tabbed-content.component.html index 5de590c1eda..0072b639c4f 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/tabbed-content.component.html +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/tabbed-content.component.html @@ -17,6 +17,9 @@
+ +
+
diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/tabbed-content.component.scss b/src/themes/custom/app/item-page/simple/item-types/untyped-item/tabbed-content.component.scss index c47f37b0f5a..78e49946a0d 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/tabbed-content.component.scss +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/tabbed-content.component.scss @@ -4,7 +4,6 @@ border: 1px solid #e0e0e0; border-radius: 4px; overflow: hidden; - font-family: 'Arial', sans-serif; } .tab-header { diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/tabbed-content.component.ts b/src/themes/custom/app/item-page/simple/item-types/untyped-item/tabbed-content.component.ts index 9195bc401a3..2c438642cbb 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/tabbed-content.component.ts +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/tabbed-content.component.ts @@ -4,11 +4,18 @@ import { Item } from 'src/app/core/shared/item.model'; import { ItemPageCcLicenseFieldComponent } from 'src/app/item-page/simple/field-components/specific-field/cc-license/item-page-cc-license-field.component'; import { FullItemComponent } from './full-item.component'; import { ContentFilesComponent } from './content-files.component'; +import { ApaCitationComponent } from './apa-citation.component'; @Component({ selector: 'ds-tabbed-content', standalone: true, - imports: [CommonModule, ItemPageCcLicenseFieldComponent, FullItemComponent, ContentFilesComponent], + imports: [ + CommonModule, + ItemPageCcLicenseFieldComponent, + FullItemComponent, + ContentFilesComponent, + ApaCitationComponent, + ], templateUrl: './tabbed-content.component.html', styleUrls: ['./tabbed-content.component.scss'] }) @@ -20,6 +27,7 @@ export class TabbedContentComponent { tabs = [ { label: 'Contenido' }, { label: 'Licencia' }, + { label: 'Cita' }, { label: 'Registro completo' } ]; diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.html b/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.html index 60da797b752..ebbb606b1b1 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.html +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.html @@ -1,73 +1,123 @@ -
-
-
-
-
-
- -
-

- - -

+ +
+
+
+
+
+
- -
-
-
+

- - + [fields]="['dc.title']"> - - -

+
-
- - + +
+
+

+ + +

+
+
+ + + + + + + + + + + + + + +
+ + [fields]="['dc.coverage.spatial']" + [label]="'Alcance geográfico'"> + [fields]="['dc.coverage.temporal']" + [label]="'Alcance temporal'"> + [fields]="['dc.coverage.spatial', 'dc.coverage.temporal']" + [separator]="', '"> + [fields]="['dc.coverage.spatial', 'dc.coverage.temporal']" + [separator]="', '" + [label]="'Alcance geográfico y temporal'"> +
+
- - + [fields]="['dc.subject']" + [separator]="'; '" + [label]="'item.page.subject'"> + +
+
+ + + + + + + + +
+
+
+ +
+
+
- - - - +
Información de la tesis
Información general
Información g [fields]="['thesis.degree.grantor']" [label]="'Institución otorgante'"> - -
Información general
- - + +
Información general
+ [fields]="['dc.title.alternative']" + [label]="'Título alternativo'"> + + - - - - - - - - - - - - - - - + [fields]="['dc.format.extent']" + [label]="'Páginas'"> + + + [fields]="['dc.audience']" + [label]="'Contexto de uso'"> + [fields]="['dc.publisher']" + [label]="subtype === ('Discurso' || 'Entrevista') ? 'Producción' : 'Editorial'"> - - - - @@ -186,90 +201,13 @@
- -
- - - - - - - - -
-
+
LA REFERENCIA -
+
+
-
- - - - - - - - \ No newline at end of file diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.scss b/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.scss index 4421d20a190..5108aaaa558 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.scss +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.scss @@ -6,18 +6,17 @@ .badge-title-content { display: flex; flex-direction: column; - - h4 { - font-size: 1.75rem; - color: #999; - margin-bottom: 0.5rem; - } + color: #999; } .edit-menu { margin-left: auto; } +.subtitle-container { + margin-top: 10px; +} + .subtitle-content { font-style: italic; color: #555; @@ -36,15 +35,11 @@ .item-identifiers { display: flex; flex-wrap: wrap; - gap: 0.2em; - - div { - display: inline-block; - padding-right: 0.2em; - } + gap: 0.2rem; } .reference-image { max-width: 100%; height: auto; + margin-bottom: 10px; } \ No newline at end of file diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.ts b/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.ts index f7bf1258b23..6243daf04a6 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.ts +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.ts @@ -14,33 +14,13 @@ import { TranslateModule } from '@ngx-translate/core'; import { Context } from '../../../../../../../app/core/shared/context.model'; import { Item } from '../../../../../../../app/core/shared/item.model'; import { ViewMode } from '../../../../../../../app/core/shared/view-mode.model'; -import { CollectionsComponent } from '../../../../../../../app/item-page/field-components/collections/collections.component'; -import { ThemedMediaViewerComponent } from '../../../../../../../app/item-page/media-viewer/themed-media-viewer.component'; -import { MiradorViewerComponent } from '../../../../../../../app/item-page/mirador-viewer/mirador-viewer.component'; -import { ThemedFileSectionComponent } from '../../../../../../../app/item-page/simple/field-components/file-section/themed-file-section.component'; -import { ItemPageAbstractFieldComponent } from '../../../../../../../app/item-page/simple/field-components/specific-field/abstract/item-page-abstract-field.component'; -import { ItemPageCcLicenseFieldComponent } from '../../../../../../../app/item-page/simple/field-components/specific-field/cc-license/item-page-cc-license-field.component'; -import { ItemPageDateFieldComponent } from '../../../../../../../app/item-page/simple/field-components/specific-field/date/item-page-date-field.component'; -import { ItemPageAuthorFieldComponent } from '../../../../../../../app/item-page/simple/field-components/specific-field/author/item-page-author-field.component'; import { GenericItemPageFieldComponent } from '../../../../../../../app/item-page/simple/field-components/specific-field/generic/generic-item-page-field.component'; -import { ThemedItemPageTitleFieldComponent } from '../../../../../../../app/item-page/simple/field-components/specific-field/title/themed-item-page-field.component'; import { ItemPageUriFieldComponent } from '../../../../../../../app/item-page/simple/field-components/specific-field/uri/item-page-uri-field.component'; import { UntypedItemComponent as BaseComponent } from '../../../../../../../app/item-page/simple/item-types/untyped-item/untyped-item.component'; -import { ThemedMetadataRepresentationListComponent } from '../../../../../../../app/item-page/simple/metadata-representation-list/themed-metadata-representation-list.component'; import { DsoEditMenuComponent } from '../../../../../../../app/shared/dso-page/dso-edit-menu/dso-edit-menu.component'; -import { MetadataFieldWrapperComponent } from '../../../../../../../app/shared/metadata-field-wrapper/metadata-field-wrapper.component'; import { listableObjectComponent } from '../../../../../../../app/shared/object-collection/shared/listable-object/listable-object.decorator'; -import { ThemedResultsBackButtonComponent } from '../../../../../../../app/shared/results-back-button/themed-results-back-button.component'; -import { ThemedThumbnailComponent } from '../../../../../../../app/thumbnail/themed-thumbnail.component'; -import { MetadataValuesComponent } from 'src/app/item-page/field-components/metadata-values/metadata-values.component'; -import { MetadataRepresentationListComponent } from '../../metadata-representation-list/metadata-representation-list.component'; -import { FileSectionComponent } from '../../field-components/file-section/file-section.component'; -import { MediaViewerComponent } from '../../../media-viewer/media-viewer.component'; -import { ThumbnailComponent } from 'src/themes/custom/app/thumbnail/thumbnail.component'; -import { ResultsBackButtonComponent } from 'src/themes/custom/app/shared/results-back-button/results-back-button.component'; import { SediciContextBadgeComponent } from 'src/themes/custom/app/shared/object-collection/shared/badges/sedici-context-badge/sedici-context-badge.component'; import { LanguageSwitcherComponent } from './language-switcher.component'; -import { ApaCitationComponent } from './apa-citation.component'; import { MetadataValue } from 'src/app/core/shared/metadata.models'; import { BadgeMetadataValuesComponent } from '../../field-components/badge-metadata-values/badge-metadata-values.component'; import { TruncatableComponent } from 'src/app/shared/truncatable/truncatable.component'; @@ -48,6 +28,9 @@ import { TruncatablePartComponent } from 'src/app/shared/truncatable/truncatable import { TabbedContentComponent } from './tabbed-content.component'; import { SediciDateMetadataValuesComponent } from '../../field-components/date-metadata-values/sedici-date-metadata-values.component'; import { SediciLanguageMetadataValuesComponent } from '../../field-components/language-metadata-values/sedici-language-metadata-values.component'; +import { setPersistentIdentifiers } from 'src/app/shared/utils/persistent.identifier'; +import { SediciTruncatableGenericItemPageFieldComponent } from './sedici-truncatable-generic-item-page-field'; + /** * Component that represents an untyped Item page */ @@ -64,89 +47,32 @@ import { SediciLanguageMetadataValuesComponent } from '../../field-components/la NgIf, NgFor, NgStyle, - ThemedResultsBackButtonComponent, - MiradorViewerComponent, - ThemedItemPageTitleFieldComponent, DsoEditMenuComponent, - MetadataFieldWrapperComponent, - ThemedThumbnailComponent, - ThemedMediaViewerComponent, - ThemedFileSectionComponent, - ItemPageDateFieldComponent, - ThemedMetadataRepresentationListComponent, GenericItemPageFieldComponent, - ItemPageAbstractFieldComponent, ItemPageUriFieldComponent, - CollectionsComponent, RouterLink, AsyncPipe, TranslateModule, - ItemPageCcLicenseFieldComponent, - MetadataValuesComponent, - MetadataRepresentationListComponent, - FileSectionComponent, - MediaViewerComponent, - ThumbnailComponent, - ResultsBackButtonComponent, LanguageSwitcherComponent, - ItemPageAuthorFieldComponent, BadgeMetadataValuesComponent, TruncatableComponent, TruncatablePartComponent, - ApaCitationComponent, TabbedContentComponent, SediciDateMetadataValuesComponent, SediciLanguageMetadataValuesComponent, SediciContextBadgeComponent, + SediciTruncatableGenericItemPageFieldComponent, ], }) export class UntypedItemComponent extends BaseComponent { - hasMultipleLanguages: boolean; subtype; identifierOtherMetadataName = ['dc.identifier.uri', 'sedici.identifier.other']; - itemIdentifiers: { mdValue: MetadataValue, label: string }[]; + itemIdentifiers: { mdValue: MetadataValue, label: string, url: string }[]; ngOnInit() { super.ngOnInit(); const abstracts = this.object.metadata['dc.description.abstract']; - this.hasMultipleLanguages = abstracts && abstracts.length > 1; this.subtype = this.object.metadata['sedici.subtype'][0]?.value; - this.setIdentifierOtherValues(); - } - - setIdentifierOtherValues(): void { - this.itemIdentifiers = []; - const length = this.itemIdentifiers.push({ - mdValue: new MetadataValue(), - label: 'HDL' - }); - this.itemIdentifiers[length - 1].mdValue.value = this.object?.handle; - this.object.allMetadata(this.identifierOtherMetadataName).forEach( - (mdValue, index) => { - let charIndex = -1; - let label = ''; - if (mdValue.value.includes(this.object?.handle)) { - if (mdValue.value.includes('doi')) { - label = 'DOI'; - } else { - return; - } - } else { - if (!mdValue.value.startsWith('http')) { - const splitChar = mdValue.value.includes(':') ? ':' : ' '; - charIndex = mdValue.value.indexOf(splitChar); - label = mdValue.value.substring(0, charIndex).toUpperCase(); - } else { - label = 'URL'; - } - } - const value = mdValue.value.substring(charIndex + 1).trim(); - const identifierListLength = this.itemIdentifiers.push({ - mdValue: new MetadataValue(), - label: label - }); - this.itemIdentifiers[identifierListLength - 1].mdValue.value = value; - } - ); + this.itemIdentifiers = setPersistentIdentifiers(this.object, this.identifierOtherMetadataName); } } diff --git a/src/themes/custom/app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component.ts b/src/themes/custom/app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component.ts index 24e0006b884..f0ceef75ff4 100644 --- a/src/themes/custom/app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component.ts +++ b/src/themes/custom/app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component.ts @@ -2,9 +2,24 @@ import { AsyncPipe, NgIf, } from '@angular/common'; -import { Component } from '@angular/core'; +import { + Component, +} from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; +import { + of as observableOf, +} from 'rxjs'; +import { + catchError, + map, +} from 'rxjs/operators'; +import { environment } from 'src/environments/environment'; +import { Item } from 'src/app/core/shared/item.model'; +import { ITEM } from 'src/app/core/shared/item.resource-type'; +import { hasValue } from 'src/app/shared/empty.util'; +import { AccessStatusObject } from 'src/app/shared/object-collection/shared/badges/access-status-badge/access-status.model'; import { AccessStatusBadgeComponent as BaseComponent } from 'src/app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component'; +import { RemoteData } from 'src/app/core/data/remote-data'; @Component({ selector: 'ds-themed-access-status-badge', @@ -15,4 +30,44 @@ import { AccessStatusBadgeComponent as BaseComponent } from 'src/app/shared/obje imports: [NgIf, AsyncPipe, TranslateModule], }) export class AccessStatusBadgeComponent extends BaseComponent { + + ngOnInit(): void { + this.showAccessStatus = environment.item.showAccessStatuses; + if (this.object.type.toString() !== ITEM.value || !this.showAccessStatus || this.object == null) { + // Do not show the badge if the feature is inactive or if the item is null. + return; + } + + const item = this.object as Item; + let accessStatus$; + + if (item.accessStatus == null) { + // In case the access status has not been loaded, do it individually. + accessStatus$ = this.accessStatusDataService.findAccessStatusFor(item); + } else { + accessStatus$ = item.accessStatus; + } + + this.accessStatus$ = accessStatus$.pipe( + map((accessStatusRD: RemoteData) => { + if (accessStatusRD.statusCode !== 401 && hasValue(accessStatusRD.payload)) { + return accessStatusRD.payload; + } else { + return []; + } + }), + map((accessStatus: AccessStatusObject) => hasValue(accessStatus.status) ? accessStatus.status : 'unknown'), + map((status: string) => `access-status.${status.toLowerCase()}.listelement.badge`), + catchError(() => observableOf('access-status.unknown.listelement.badge')), + ); + + // stylesheet based on the access status value + this.subs.push( + this.accessStatus$.pipe( + map((accessStatusClass: string) => accessStatusClass.replace(/\./g, '-')), + ).subscribe((accessStatusClass: string) => { + this.accessStatusClass = accessStatusClass; + }), + ); + } } diff --git a/src/themes/custom/app/shared/object-collection/shared/badges/sedici-context-badge/sedici-context-badge.component.scss b/src/themes/custom/app/shared/object-collection/shared/badges/sedici-context-badge/sedici-context-badge.component.scss index b8cb48e7358..f0f3ec93a31 100644 --- a/src/themes/custom/app/shared/object-collection/shared/badges/sedici-context-badge/sedici-context-badge.component.scss +++ b/src/themes/custom/app/shared/object-collection/shared/badges/sedici-context-badge/sedici-context-badge.component.scss @@ -5,7 +5,7 @@ .context-info, .context-year { - font-size: 12px; + font-size: .75rem; position: relative; &:hover::after { content: ''; diff --git a/src/themes/custom/app/shared/object-collection/shared/badges/sedici-context-badge/sedici-context-badge.component.ts b/src/themes/custom/app/shared/object-collection/shared/badges/sedici-context-badge/sedici-context-badge.component.ts index 6ba11b96d53..2b0a365519d 100644 --- a/src/themes/custom/app/shared/object-collection/shared/badges/sedici-context-badge/sedici-context-badge.component.ts +++ b/src/themes/custom/app/shared/object-collection/shared/badges/sedici-context-badge/sedici-context-badge.component.ts @@ -27,6 +27,20 @@ export class SediciContextBadgeComponent extends BaseComponent { } } + getBookInfo(): string { + const bookTitle = this.object.firstMetadataValue('sedici.relation.bookTitle'); + const isPartOf = this.object.firstMetadataValue('dc.relation.ispartof'); + + if (bookTitle && isPartOf) { + return `${bookTitle}; ${isPartOf}`; + } else if (bookTitle) { + return bookTitle; + } else if (isPartOf) { + return isPartOf; + } + return ''; + } + getJournalInfo(): string { const journalTitle = this.object.firstMetadataValue('sedici.relation.journalTitle'); const journalVolumeAndIssue = this.object.firstMetadataValue('sedici.relation.journalVolumeAndIssue'); @@ -35,35 +49,45 @@ export class SediciContextBadgeComponent extends BaseComponent { return `${journalTitle}; ${journalVolumeAndIssue}`; } else if (journalTitle) { return journalTitle; - } else { - return ''; } + return ''; } - getOriginInfoPlace(): string { - let place = this.object.firstMetadataValue('mods.originInfo.place'); - if (!place) { - return ''; + getEventInfo(): string { + const event = this.object.firstMetadataValue('sedici.relation.event'); + if (event) { + return event; } - return place; + return ''; } - getEventInfo(): string { - let event = this.object.firstMetadataValue('sedici.relation.event'); - if (!event) { - return ''; + getCicloInfo(): string { + const ciclo = this.object.firstMetadataValue('sedici.relation.ciclo'); + if (ciclo) { + return ciclo; + } + return ''; + } + + getOriginInfoPlace(): string { + let originInfo = this.object.firstMetadataValue('mods.originInfo.place'); + if (originInfo) { + return originInfo; } - return event; + return ''; } getContextInfo(): string { - let thesis = this.getThesisInfo(); - let journal = this.getJournalInfo(); - let event = this.getEventInfo(); - let origin = this.getOriginInfoPlace(); + const thesis = this.getThesisInfo(); if (thesis) { return thesis; }; + const bookTitle = this.getBookInfo(); + if (bookTitle) { + return bookTitle; + }; + const journal = this.getJournalInfo(); + const event = this.getEventInfo(); if (journal || event) { if (journal && event) { return `${journal} | ${event}`; @@ -73,14 +97,22 @@ export class SediciContextBadgeComponent extends BaseComponent { return event; }; }; - return origin; + const ciclo = this.getCicloInfo(); + if (ciclo) { + return ciclo; + }; + const originInfo = this.getOriginInfoPlace(); + if (originInfo) { + return originInfo; + }; + return ''; } getYear(): string { - let dateString = this.object.firstMetadataValue('dc.date.issued') || this.object.firstMetadataValue('dc.date.created'); - if (!dateString) { - return ''; + let dateString = this.object.firstMetadataValue('dc.date.issued') || this.object.firstMetadataValue('dc.date.created') || this.object.firstMetadataValue('sedici.date.exposure'); + if (dateString) { + return dateString.split('-')[0]; } - return dateString.split('-')[0]; + return ''; } }