Skip to content
Merged
Prev Previous commit
Next Next commit
Fix license code generation regression (creator was not added)
  • Loading branch information
obulat committed Dec 5, 2020
commit 0531eadd75ac3660d08a65def16df7621a88e1f2
12 changes: 9 additions & 3 deletions src/components/LicenseCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
</template>
<template #creator>
<component
:is="creatorName && creatorProfileUrl && isWeb ? 'a' : 'span'"
:is="isCreatorLink ? 'a' : 'span'"
v-if="creatorName"
v-bind="creatorProps"
>
{{ creatorName }}
</component>
</template>
<template #by>
{{ $t(byString) }}
{{ byString }}
</template>
<template #licenseMark>
<span>{{ $t(licensedMarkedString) }}</span>
Expand Down Expand Up @@ -68,9 +68,15 @@ export default {
licensedMarkedString() {
return this.shortName === 'CC0 1.0' ? 'license-use.richtext.marked-text' : 'license-use.richtext.licensed-text'
},
isCreatorLink() {
return this.attributionDetails.creatorName && this.creatorProfileUrl && this.isWeb
},
byString() {
return this.creatorName ? this.$t('license-use.richtext.by') : ''
},
creatorProps() {
const creatorAttrs = { property: 'cc:attributionName' }
if (this.creatorName && this.creatorProfileUrl && this.isWeb) {
if (this.isCreatorLink) {
creatorAttrs.href = this.creatorProfileUrl
creatorAttrs.rel = 'cc:attributionURL'
}
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"copy-label": "Copy",
"copied-label": "Copied!",
"richtext": {
"full-text": "{workTitle} {byCreator} {licenseMark} {license}",
"full-text": "{workTitle} {by} {creator} {licenseMark} {license}",
"workTitle": "This work",
"by": "by",
"licensed-text": "is licensed under",
Expand Down