Skip to content

Commit

Permalink
11008 Primera versión vista del ítem; cambio tamaño font-size-base
Browse files Browse the repository at this point in the history
  • Loading branch information
178Pelado committed Oct 4, 2024
1 parent 5cd8673 commit 74be601
Show file tree
Hide file tree
Showing 42 changed files with 705 additions and 521 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
<!-- <div class="simple-view-element" [class.d-none]="hideIfNoTextContent && content.textContent.trim().length === 0">
<h2 class="simple-view-element-header" *ngIf="label">{{ label }}</h2>
<div #content class="simple-view-element-body">
<ng-content></ng-content>
</div>
</div> -->

<div class="simple-view-element" [ngClass]="{'not-inline-label': !inlineLabel }" [class.d-none]="hideIfNoTextContent && content.textContent.trim().length === 0">
<h6 class="simple-view-element-header" *ngIf="label">{{ label }}</h6>
<div #content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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;
Expand All @@ -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<AccessStatusObject>) => {
this.accessStatus$ = item.accessStatus.pipe(
map((accessStatusRD) => {
if (accessStatusRD.statusCode !== 401 && hasValue(accessStatusRD.payload)) {
return accessStatusRD.payload;
} else {
Expand Down
68 changes: 68 additions & 0 deletions src/app/shared/utils/persistent.identifier.ts
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion src/styles/_bootstrap_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/styles/_custom_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 20 additions & 0 deletions src/themes/custom/app/breadcrumbs/breadcrumbs.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<ng-container *ngVar="(breadcrumbs$ | async) as breadcrumbs">
<nav *ngIf="(showBreadcrumbs$ | async)" aria-label="breadcrumb" class="nav-breadcrumb">
<ol class="container breadcrumb my-0">
<ng-container *ngFor="let bc of breadcrumbs; let last = last;">
<ng-container *ngIf="!last">
<ng-container *ngTemplateOutlet="breadcrumb; context: bc"></ng-container>
</ng-container>
</ng-container>
</ol>
</nav>

<ng-template #breadcrumb let-text="text" let-url="url">
<li class="breadcrumb-item"><div class="breadcrumb-item-limiter"><a [routerLink]="url" class="text-truncate" [ngbTooltip]="text | translate" placement="bottom" >{{text | translate}}</a></div></li>
</ng-template>

<ng-template #activeBreadcrumb let-text="text">
<li class="breadcrumb-item active" aria-current="page"><div class="breadcrumb-item-limiter"><div class="text-truncate">{{text | translate}}</div></div></li>
</ng-template>
</ng-container>

38 changes: 38 additions & 0 deletions src/themes/custom/app/breadcrumbs/breadcrumbs.component.scss
Original file line number Diff line number Diff line change
@@ -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;
}
8 changes: 4 additions & 4 deletions src/themes/custom/app/breadcrumbs/breadcrumbs.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
<ds-metadata-field-wrapper [label]="label | translate" [inlineLabel]="false">
<a href="{{ badgeUrl }}" target="_blank" *ngIf="badgeUrl else badge">
<ng-container *ngTemplateOutlet="badge"></ng-container>
</a>
<a href="{{ badgeUrl }}" target="_blank" *ngIf="badgeUrl else badge">
<ng-container *ngTemplateOutlet="badge"></ng-container>
</a>
</ds-metadata-field-wrapper>

<ng-template #badge>
<div class="badge-group" [ngClass]="{'group-inline-block': badgeLabel}" *ngFor="let mdValue of mdValues">
<span class="badge badge-label" [ngClass]="badgeLabelType" *ngIf="badgeLabel">
{{badgeLabel}}
</span>
<span class="badge {{badgeType}}" [ngClass]="{'badge-content': badgeLabel}">
{{mdValue.value}}
<ng-container *ngIf="copyToClipboardButton">
<span class="d-none" #elementContentToCopy>{{mdValue.value}}</span>
<i id="copyButton-{{mdValue.value}}" class="copyButton fa fa-copy" aria-hidden="true" (click)="copyToClipboard(elementContentToCopy, 'copyButton-' + mdValue.value )"></i>
</ng-container>
</span>
</div>
<div class="badge-group" [ngClass]="{'group-inline-block': badgeLabel}" *ngFor="let mdValue of mdValues">
<span class="badge badge-label" [ngClass]="badgeLabelType" *ngIf="badgeLabel">
{{badgeLabel}}
</span>
<span class="badge {{badgeType}}" [ngClass]="{'badge-content': badgeLabel}">
<a *ngIf="url; else plainText" href="{{ url }}" target="_blank" class="no-format">{{ mdValue.value }}</a>
<ng-template #plainText>{{ mdValue.value }}</ng-template>
<ng-container *ngIf="copyToClipboardButton">
<span class="d-none" #elementContentToCopy>{{mdValue.value}}</span>
<i id="copyButton-{{mdValue.value}}" class="copyButton fa fa-copy" aria-hidden="true" (click)="copyToClipboard(elementContentToCopy, 'copyButton-' + mdValue.value )"></i>
</ng-container>
</span>
</div>
</ng-template>

Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="item-page-field">
<ds-metadata-values
[mdValues]="mdValues"
[separator]="separator"
[label]="label"
></ds-metadata-values>
</div>
Original file line number Diff line number Diff line change
@@ -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 = '<br/>';

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));
});
}
}
15 changes: 15 additions & 0 deletions src/themes/custom/app/item-page/simple/item-page.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div *ngVar="(itemRD$ | async) as itemRD">
<div class="item-page" *ngIf="itemRD?.hasSucceeded" @fadeInOut>
<div *ngIf="itemRD?.payload as item">
<ds-item-alerts [item]="item"></ds-item-alerts>
<ds-qa-event-notification [item]="item"></ds-qa-event-notification>
<ds-notify-requests-status [itemUuid]="item.uuid"></ds-notify-requests-status>
<ds-item-versions-notice [item]="item"></ds-item-versions-notice>
<ds-view-tracker [object]="item"></ds-view-tracker>
<ds-listable-object-component-loader *ngIf="!item.isWithdrawn || (isAdmin$|async)" [object]="item" [viewMode]="viewMode"></ds-listable-object-component-loader>
<ds-item-versions class="mt-2" [item]="item" [displayActions]="false"></ds-item-versions>
</div>
</div>
<ds-error *ngIf="itemRD?.hasFailed" message="{{'error.item' | translate}}"></ds-error>
<ds-loading *ngIf="itemRD?.isLoading" message="{{'loading.item' | translate}}"></ds-loading>
</div>
8 changes: 4 additions & 4 deletions src/themes/custom/app/item-page/simple/item-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 74be601

Please sign in to comment.