Skip to content

Commit

Permalink
Show concordance license in ConcordanceDetail
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandesu committed Nov 27, 2023
1 parent eb7a8a6 commit fdd64b1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
2 changes: 2 additions & 0 deletions config/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"type": "Type",
"noRegistries": "The configuration contains no providers. Please consult the <a href='https://gbv.github.io/cocoda/#configuration' target='_blank'>documentation</a> how to configure providers!",
"catalog": "catalog",
"license": "License",
"storedMappings": "Mappings",
"recommendedMappings": "Suggestions"
},
Expand Down Expand Up @@ -435,6 +436,7 @@
"type": "Typ",
"noRegistries": "Es sind keine Datenquellen konfiguriert! Bitte entnehmen sie der <a href='https://gbv.github.io/cocoda/#configuration' target='_blank'>Dokumentation</a> wie Datenquellen konfiguriert werden können!",
"catalog": "Katalog",
"license": "Lizenz",
"storedMappings": "Mappings",
"recommendedMappings": "Vorschläge"
},
Expand Down
23 changes: 23 additions & 0 deletions src/components/ConcordanceDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,29 @@
</b-col>
<b-col><auto-link :link="concordance.url" /></b-col>
</b-row>
<!-- License -->
<b-row v-if="concordance.license?.length">
<b-col cols="3">
{{ $t("general.license") }}:
</b-col>
<b-col>
<span
v-for="(license, index) in concordance.license"
:key="`concordanceDetail-license-${index}`">
<a
:href="license.uri"
target="_blank">
<img
v-if="defaults.licenseBadges[license.uri]"
:src="defaults.licenseBadges[license.uri]"
class="schemeDetail-licenseBadge">
<span v-else>
{{ license.uri }}
</span>
</a>
</span>
</b-col>
</b-row>
<!-- Distributions -->
<b-row v-if="concordance.distributions && concordance.distributions.length">
<b-col cols="3">
Expand Down
26 changes: 16 additions & 10 deletions src/mixins/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") // $& means the whole matched string
}

const licenseBadges = {
"http://creativecommons.org/publicdomain/zero/1.0/": "https://mirrors.creativecommons.org/presskit/buttons/80x15/svg/cc-zero.svg",
"http://creativecommons.org/licenses/by/3.0/": "https://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by.svg",
"http://creativecommons.org/licenses/by-nc-nd/3.0/": "https://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by-nc-nd.svg",
"http://creativecommons.org/licenses/by-nc-nd/4.0/": "https://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by-nc-nd.svg",
"http://creativecommons.org/licenses/by-nc-sa/4.0/": "https://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by-nc-sa.svg",
"http://creativecommons.org/licenses/by-sa/4.0/": "https://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by-sa.svg",
"http://opendatacommons.org/licenses/odbl/1.0/": "https://img.shields.io/badge/License-ODbL-lightgrey.svg",
"http://www.wtfpl.net/": "https://img.shields.io/badge/License-WTFPL-lightgrey.svg",
}
// Duplicate license URIs with https
Object.keys(licenseBadges).forEach(key => {
licenseBadges[key.replace("http:", "https:")] = licenseBadges[key]
})

export default {
data() {
return {
Expand All @@ -22,16 +37,7 @@ export default {
medium: { show: 500, hide: 0 },
long: { show: 1000, hide: 0 },
},
licenseBadges: {
"http://creativecommons.org/publicdomain/zero/1.0/": "https://mirrors.creativecommons.org/presskit/buttons/80x15/svg/cc-zero.svg",
"http://creativecommons.org/licenses/by/3.0/": "https://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by.svg",
"http://creativecommons.org/licenses/by-nc-nd/3.0/": "https://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by-nc-nd.svg",
"http://creativecommons.org/licenses/by-nc-nd/4.0/": "https://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by-nc-nd.svg",
"http://creativecommons.org/licenses/by-nc-sa/4.0/": "https://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by-nc-sa.svg",
"http://creativecommons.org/licenses/by-sa/4.0/": "https://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by-sa.svg",
"http://opendatacommons.org/licenses/odbl/1.0/": "https://img.shields.io/badge/License-ODbL-lightgrey.svg",
"http://www.wtfpl.net/": "https://img.shields.io/badge/License-WTFPL-lightgrey.svg",
},
licenseBadges,
},
}
},
Expand Down

0 comments on commit fdd64b1

Please sign in to comment.