From e8d57386f3033941e8303c68e1caeacc3349ec5b Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 8 May 2023 10:53:38 +0300 Subject: [PATCH] [Library | explore-redesign]: Updated icon for "not available" access of sources on research products. 1. icons.ts: Added custom icon "unknown_access", when access is not available (locker with questionmark inside). 2. parsingFunctions.class.ts: Set "accessRightIcon" of each source to "unknown_access" icon, when access is not available. 3. resultLandingUtils.module.ts: Added "unknown_access" icon in iconsService.registerIcons. 4. resultLanding.component.html: Mobile view: Updated tooltip of access - added "access" word in the end. 5. availableOn.component.ts: Updated tooltip of access - added "access" word in the end. 6. result-preview.component.html: In mobile view, show access on the top right, next to the title. 7. searchResearchResults.service.ts: [Bug fix] Call parsingFunctions.addPublisherToHostedBy_collectedFrom after parsing journal, publisher and identifiers. --- .../landing-utils/availableOn.component.ts | 4 +- .../landing-utils/parsingFunctions.class.ts | 25 +++-- .../resultLandingUtils.module.ts | 4 +- .../result/resultLanding.component.html | 2 +- services/searchResearchResults.service.ts | 8 +- utils/icons/icons.ts | 9 ++ .../result-preview.component.html | 91 ++++++++++--------- 7 files changed, 80 insertions(+), 63 deletions(-) diff --git a/landingPages/landing-utils/availableOn.component.ts b/landingPages/landing-utils/availableOn.component.ts index 24afa28e..186e5ace 100644 --- a/landingPages/landing-utils/availableOn.component.ts +++ b/landingPages/landing-utils/availableOn.component.ts @@ -13,7 +13,7 @@ declare var UIkit;
+ uk-tooltip [title]="(availableOn[0].accessRight ? availableOn[0].accessRight : 'Not available') + ' access'"> @@ -52,7 +52,7 @@ declare var UIkit;
+ uk-tooltip [title]="(instance.accessRight ? instance.accessRight : 'Not available') + ' access'">
diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index 20e85f19..b740876a 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -38,8 +38,8 @@ export class ParsingFunctions { public open = 'open_access'; public closed = 'closed_access'; - // public unknown = 'question_mark'; - + public unknown = 'unknown_access'; + private instanceWithDoiExists: boolean = false; constructor() { @@ -194,7 +194,7 @@ export class ParsingFunctions { } available.downloadUrl = properties.doiURL + identifiers.get("doi")[0]; - // available.accessRightIcon = this.unknown; + available.accessRightIcon = this.unknown; /* if(title != undefined && title['url'] == "") { title['url'] = url; @@ -282,7 +282,7 @@ export class ParsingFunctions { "years": [], "license": "" }; - + if (instance.hasOwnProperty("hostedby")) { let downloadNames: Set = new Set(); let length = Array.isArray(instance['hostedby']) ? instance['hostedby'].length : 1; @@ -351,21 +351,20 @@ export class ParsingFunctions { } } - + if (available.accessRight) { if (available.accessRight.toLowerCase().indexOf('open') !== -1) { available.accessRightIcon = this.open; - } - // else if (available.accessRight.toLowerCase().indexOf('not available') !== -1) { - // available.accessRightIcon = this.unknown; - // } + } + else if (available.accessRight.toLowerCase().indexOf('not available') !== -1) { + available.accessRightIcon = this.unknown; + } else { available.accessRightIcon = this.closed; } - } - // else { - // available.accessRightIcon = this.unknown; - // } + } else { + available.accessRightIcon = this.unknown; + } if (instance.hasOwnProperty("license")) { available.license = Array.isArray(instance['license']) ? instance['license'][0] : instance['license']; diff --git a/landingPages/landing-utils/resultLandingUtils.module.ts b/landingPages/landing-utils/resultLandingUtils.module.ts index a8079694..ebf29782 100644 --- a/landingPages/landing-utils/resultLandingUtils.module.ts +++ b/landingPages/landing-utils/resultLandingUtils.module.ts @@ -19,7 +19,7 @@ import {AlertModalModule} from "../../utils/modal/alertModal.module"; import { SearchInputModule } from '../../sharedComponents/search-input/search-input.module'; import {EntityMetadataComponent} from "./entity-metadata.component"; import {IconsService} from "../../utils/icons/icons.service"; -import {closed_access, open_access} from "../../utils/icons/icons"; +import {closed_access, open_access, unknown_access} from "../../utils/icons/icons"; import {FullScreenModalModule} from "../../utils/modal/full-screen-modal/full-screen-modal.module"; @@ -44,6 +44,6 @@ import {FullScreenModalModule} from "../../utils/modal/full-screen-modal/full-sc }) export class ResultLandingUtilsModule { constructor(private iconsService: IconsService) { - this.iconsService.registerIcons([open_access, closed_access]); + this.iconsService.registerIcons([open_access, closed_access, unknown_access]); } } diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 0f85204b..cb7e2e7b 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -490,7 +490,7 @@ class="uk-margin-small-bottom uk-flex uk-flex-middle" [ngClass]="(resultLandingInfo.hostedBy_collectedFrom[0].accessRightIcon == 'open_access' ? 'open-access' : 'closed-access')"> - {{resultLandingInfo.hostedBy_collectedFrom[0].accessRight}} + {{(resultLandingInfo.hostedBy_collectedFrom[0].accessRight ? resultLandingInfo.hostedBy_collectedFrom[0].accessRight : 'Not available') + ' access'}}
image/svg+xml Jakob Voss, based on art designer at PLoS, modified by Wikipedia users Nina and Beao Closed Access logo, derived from PLoS Open Access logo. This version with transparent background. http://commons.wikimedia.org/wiki/File:Closed_Access_logo_transparent.svg Jakob Voss, based on art designer at PLoS, modified by Wikipedia users Nina and Beao ' } /** Add new icon under this line to be sure that it will be added on preview */ + +export const unknown_access = { + name: 'unknown_access', + data: '\n' + + ' \n' + + ' \n' + + ' \n' + + '' +} \ No newline at end of file diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index 7db00273..b2cbfc0e 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -19,51 +19,60 @@