From f264e917b3a51097d4a9a6c6c2e2aabccb28dc2d Mon Sep 17 00:00:00 2001 From: Konstantina Stoikou Date: Fri, 3 Apr 2020 18:29:48 +0200 Subject: [PATCH] global: add identifiers tab in documents frontsite and display isbn in backoffice (#791) * add identifiers tab in document frontsite and fix problems with identifiers in backoffice * Add isbn to identifiers vocabulary --- .../data/alternative_identifier_schemes.json | 7 +------ .../vocabularies/data/identifier_schemes.json | 7 ++++++- .../DocumentMetadata/DocumentIdentifiers.js | 8 +++++--- .../components/Document/DocumentInfo.js | 17 +++++++++++++++++ .../Document/DocumentMetadataTabs.js | 18 ++++++++++++++++++ .../components/Document/DocumentRelations.js | 1 + .../components/Identifiers/Identifiers.js | 2 +- 7 files changed, 49 insertions(+), 11 deletions(-) diff --git a/invenio_app_ils/vocabularies/data/alternative_identifier_schemes.json b/invenio_app_ils/vocabularies/data/alternative_identifier_schemes.json index 6af52cd77..682c0934b 100644 --- a/invenio_app_ils/vocabularies/data/alternative_identifier_schemes.json +++ b/invenio_app_ils/vocabularies/data/alternative_identifier_schemes.json @@ -9,11 +9,6 @@ "key": "ASIN", "text": "Amazon Standard Id. Number (ASIN)" }, - { - "type": "alternative_identifier_scheme", - "key": "ISBN", - "text": "International Standard Book Number (ISBN)" - }, { "type": "alternative_identifier_scheme", "key": "HDL", @@ -24,4 +19,4 @@ "key": "SAFARI", "text": "Safari Books Online (SAFARI)" } -] \ No newline at end of file +] diff --git a/invenio_app_ils/vocabularies/data/identifier_schemes.json b/invenio_app_ils/vocabularies/data/identifier_schemes.json index 67f672e4f..784974fda 100644 --- a/invenio_app_ils/vocabularies/data/identifier_schemes.json +++ b/invenio_app_ils/vocabularies/data/identifier_schemes.json @@ -8,5 +8,10 @@ "type": "identifier_scheme", "key": "URN", "text": "Uniform Resource Name (URN)" + }, + { + "type": "identifier_scheme", + "key": "ISBN", + "text": "International Standard Book Number (ISBN)" } -] \ No newline at end of file +] diff --git a/ui/src/pages/backoffice/Document/DocumentDetails/components/DocumentMetadata/DocumentIdentifiers.js b/ui/src/pages/backoffice/Document/DocumentDetails/components/DocumentMetadata/DocumentIdentifiers.js index e9708ad52..5522bf6d0 100644 --- a/ui/src/pages/backoffice/Document/DocumentDetails/components/DocumentMetadata/DocumentIdentifiers.js +++ b/ui/src/pages/backoffice/Document/DocumentDetails/components/DocumentMetadata/DocumentIdentifiers.js @@ -6,10 +6,12 @@ import React, { Component } from 'react'; export class DocumentIdentifiers extends Component { render() { const { document } = this.props; + const identifiers = groupedSchemeValueList(document.metadata.identifiers); + const alternative_identifiers = groupedSchemeValueList( + document.metadata.alternative_identifiers + ); return document.metadata.identifiers ? ( - + ) : ( identifier.scheme === scheme + ) + : null; + + if (!isEmpty(identifiers)) { + return ; + } + return null; + } + render() { return ( <> @@ -50,6 +65,8 @@ export class DocumentInfo extends Component { {this.metadata.keywords.value} ({this.metadata.keywords.source}) + {this.renderSpecificIdentifiers('ISBN')} + {this.renderSpecificIdentifiers('DOI')} diff --git a/ui/src/pages/frontsite/components/Document/DocumentMetadataTabs.js b/ui/src/pages/frontsite/components/Document/DocumentMetadataTabs.js index 2c1e34f7f..fadc68d02 100644 --- a/ui/src/pages/frontsite/components/Document/DocumentMetadataTabs.js +++ b/ui/src/pages/frontsite/components/Document/DocumentMetadataTabs.js @@ -7,6 +7,8 @@ import { DocumentConference } from './DocumentConference'; import { DocumentLinks } from './DocumentLinks'; import { Notes } from '../Notes'; import _get from 'lodash/get'; +import isEmpty from 'lodash/isEmpty'; +import { Identifiers } from '../Identifiers'; export class DocumentMetadataTabs extends Component { constructor(props) { @@ -28,6 +30,22 @@ export class DocumentMetadataTabs extends Component { ), }, + { + menuItem: 'Identifiers', + render: () => ( + + + + ), + }, { menuItem: 'Content', render: () => ( diff --git a/ui/src/pages/frontsite/components/Document/DocumentRelations.js b/ui/src/pages/frontsite/components/Document/DocumentRelations.js index ecc17e12a..b76dcd4fa 100644 --- a/ui/src/pages/frontsite/components/Document/DocumentRelations.js +++ b/ui/src/pages/frontsite/components/Document/DocumentRelations.js @@ -91,6 +91,7 @@ export class DocumentRelations extends Component { {this.renderSerials()} {this.renderLanguages()} {this.renderEditions()} + )} ); } else { diff --git a/ui/src/pages/frontsite/components/Identifiers/Identifiers.js b/ui/src/pages/frontsite/components/Identifiers/Identifiers.js index 0cf7b6a00..f02b4910d 100644 --- a/ui/src/pages/frontsite/components/Identifiers/Identifiers.js +++ b/ui/src/pages/frontsite/components/Identifiers/Identifiers.js @@ -31,7 +31,7 @@ export const IdentifierRows = ({ includeSchemes, identifiers }) => { // Only include whitelisted schemes if includeSchemes is set if (!includeSchemes || includeSchemes.includes(id.scheme)) { const value = { value: id.value, material: id.material }; - if (id.scheme in identifiers) { + if (id.scheme in idsByScheme) { idsByScheme[id.scheme].push(value); } else { idsByScheme[id.scheme] = [value];