Temporary fix for the keywords section when accessing from DOI

This commit is contained in:
Porras-Bernardez 2024-09-18 15:28:52 +02:00
parent 5dd8821667
commit 01e10d6f9d
3 changed files with 27 additions and 14 deletions

View File

@ -1,9 +1,4 @@
<template>
<div class="container-fluid">
<div class="development-notice">
DEVELOPMENT SITE <br> >> Only for development purposes <<
</div>
</div>
<!-- <HelloWorld msg="Welcome to Your Vue.js plus TypeScript App" /> -->
<nav class="navbar navbar-light border-bottom" role="navigation" aria-label="main navigation">
<div class="navbar-brand">

View File

@ -233,5 +233,17 @@ export default class DatasetDetailComponent extends Vue {
return citation;
}
accessNotFromDoi(): boolean {
const host = window.location.host;
const parts = host.split(".");
if (parts[0] === "doi") {
console.log("From DOI");
// If in DOI subdomain, open external search in a new window
return false;
} else {
console.log("Not From DOI");
return true;
}
}
}

View File

@ -183,15 +183,21 @@
<h3 class="label uppercase">Schlüsselwörter/Keywords</h3>
<p v-if="dataset.hasOwnProperty('subjects')">
<!-- Iterate through subjects and display them as router links -->
<span v-for="(subject, index) in dataset.subjects" :key="subject.value">
<router-link
:to="{ name: 'Search', params: { display: subject.value, type: 'subjects' } }"
class="link-label"
>
{{ subject.value }}
</router-link>
<!-- Add a comma and space after each keyword except the last one -->
<span v-if="index < dataset.subjects.length - 1">, </span>
<span v-if="accessNotFromDoi()">
<span v-for="(subject, index) in dataset.subjects" :key="subject.value">
<router-link
:to="{ name: 'Search', params: { display: subject.value, type: 'subjects' } }"
class="link-label"
>
{{ subject.value }}
</router-link>
<!-- Add a comma and space after each keyword except the last one -->
<span v-if="index < dataset.subjects.length - 1">, </span>
</span>
</span>
<span v-else>
{{ dataset.subjects.map((u) => u.value).join(", ") }}
</span>
</p>
<p v-else>-</p>