-
-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathLicenseCode.vue
130 lines (128 loc) · 3.78 KB
/
LicenseCode.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<template>
<p
xmlns:dct="http://purl.org/dc/terms/"
xmlns:cc="http://creativecommons.org/ns#"
class="license-text"
>
<i18n
path="license-use.richtext.full-text"
tag="span"
>
<template v-slot:workTitle>
<a
v-if="workUrl && isWeb"
:href="workUrl"
rel="cc:attributionURL"
>
<span v-if="!workTitle">{{ $t('license-use.richtext.workTitle') }}</span>
<span
v-else
rel="dct:title"
>
{{ workTitle }}
</span>
</a>
<span
v-else-if="workTitle"
rel="dct:title"
>
{{ workTitle }}
</span>
<span v-else>{{ $t('license-use.richtext.workTitle') }}</span>
</template>
<template v-slot:creator>
<a
v-if="creatorProfileUrl && isWeb"
:href="creatorProfileUrl"
rel="cc:attributionURL"
>
<span v-html="creatorSpan" /></a>
<span
v-else-if="creatorName"
v-html="creatorSpan"
/>
</template>
<template v-slot:by>
{{ $t(byString) }}
</template>
<template v-slot:licensed-text>
<span>{{ $t('license-use.richtext.licensed-text') }}</span>
</template>
<template v-slot:licenseName>
<a
v-if="isWeb"
:href="licenseUrl('web')"
target="_blank"
rel="license noopener noreferrer"
style="display: inline-block;"
>
{{ shortName }}
</a>
<span v-else>{{ shortName }}</span>
<LicenseIcons
v-if="isWeb"
:url="licenseUrl('web')"
:icons-arr="iconsList"
/>
</template>
</i18n>
<i18n
v-if="!isWeb"
path="license-use.richtext.print-instructions"
tag="span"
>
<template v-slot:linkToLicenseDeed>
{{ licenseUrl('print') }}
</template>
</i18n>
</p>
</template>
<script>
import { mapGetters, mapState } from 'vuex'
import LicenseIcons from './LicenseIcons'
export default {
name: 'LicenseCode',
components: {
LicenseIcons
},
props: {
attributionType: {
type: String,
default: 'web'
}
},
computed: {
...mapGetters(['shortName', 'licenseUrl', 'iconsList']),
...mapState(['attributionDetails']),
byString() {
return this.creatorName ? 'license-use.richtext.by' : ''
},
creatorSpan() {
if (this.creatorName) {
return `<span rel="cc:attributionName">${this.creatorName}</span>`
} else return ''
},
creatorName() {
return this.attributionDetails.creatorName
},
creatorProfileUrl() {
return this.attributionDetails.creatorProfileUrl
},
workTitle() {
return this.attributionDetails.workTitle
},
workUrl() {
return this.attributionDetails.workUrl
},
isWeb() {
return this.attributionType === 'web'
}
}
}
</script>
<style scoped>
.license-text .photo-license-icons {
height: 1.4rem!important;
margin-left: 3px;
}
</style>