4
4
v-model =" activeTab"
5
5
class =" attribution-tab"
6
6
>
7
- <b-tab-item :label =" this.$t('license-use.rich-text-label')" >
8
- <div id =" attribution-richtext" >
9
- <LicenseCode ref =" licenseCode" />
7
+ <b-tab-item :label =" this.$t(firstTabLabel)" >
8
+ <div id =" attribution-text" >
9
+ <LicenseCode
10
+ :attribution-type =" textAttributionType"
11
+ />
10
12
</div >
11
13
</b-tab-item >
12
- <b-tab-item :label =" this.$t('license-use.html-label')" >
14
+ <b-tab-item
15
+ v-if =" isWeb"
16
+ :label =" this.$t('license-use.html-label')"
17
+ >
13
18
<div
14
19
id =" generated-html-container"
15
20
class =" control"
29
34
:data-clipboard-target =" clipboardTarget()"
30
35
>
31
36
<font-awesome-icon icon =" copy" />
32
- <span class =" button-text" >{{ copyText }}
33
- </span >
37
+ <span class =" button-text" >{{ copyText }}</span >
34
38
</a >
35
39
</template >
36
40
<div class =" dummy" />
42
46
import Clipboard from ' clipboard'
43
47
import { mapGetters } from ' vuex'
44
48
import LicenseCode from ' ./LicenseCode'
45
- import { generateHTML } from ' ../utils/license-utilities'
46
49
import { FontAwesomeIcon } from ' @fortawesome/vue-fontawesome'
50
+ import { generateHTML } from ' ../utils/license-utilities'
47
51
48
52
export default {
49
- name: ' WebLicenseCode ' ,
53
+ name: ' LicenseCopy ' ,
50
54
components: {
51
55
FontAwesomeIcon,
52
56
LicenseCode
53
57
},
54
58
props: {
55
- value: Object
59
+ isWeb: {
60
+ type: Boolean ,
61
+ default: true
62
+ }
56
63
},
57
64
data () {
58
65
return {
59
66
success: false ,
60
67
clipboard: null ,
61
68
currentTab: 0 ,
62
69
copyText: this .$t (' license-use.copy-label' ),
63
- currentSelection: ' richtext '
70
+ currentSelection: ' text '
64
71
}
65
72
},
66
73
computed: {
67
74
... mapGetters ([' shortName' , ' fullName' , ' iconsList' , ' licenseUrl' ]),
68
75
attributionDetails () {
69
76
return this .$store .state .attributionDetails
70
77
},
78
+ tabsCount () {
79
+ return this .isWeb ? 2 : 1
80
+ },
81
+ firstTabLabel () {
82
+ return this .isWeb ? ' license-use.rich-text-label' : ' license-use.plain-text-label'
83
+ },
84
+ textAttributionType () {
85
+ return this .isWeb ? ' web' : ' print'
86
+ },
71
87
htmlLicenseParagraph () {
72
88
const data = generateHTML (this .attributionDetails , this .shortName )
73
89
const licenseCodeSpan = this .$i18n .t (' license-use.richtext.full-text' , {
@@ -81,12 +97,12 @@ export default {
81
97
activeTab: {
82
98
get () { return this .currentTab },
83
99
set (val ) {
84
- if (val !== 2 ) {
100
+ if (val !== this . tabsCount ) {
85
101
this .currentTab = val
86
102
} else {
87
- this .currentSelection = this .currentTab === 0 ? ' richtext ' : ' html'
103
+ this .currentSelection = this .currentTab === 0 ? ' text ' : ' html'
88
104
const tab = this .currentTab
89
- this .currentTab = 2
105
+ this .currentTab = this . tabsCount
90
106
this .copyText = this .$t (' license-use.copied-label' )
91
107
setTimeout (() => {
92
108
this .currentTab = tab
@@ -117,7 +133,7 @@ export default {
117
133
const copiedLicense = {
118
134
license: this .shortName ,
119
135
// codeType can be either rich-text or html
120
- codeType: this . currentSelection ,
136
+ codeType: ' plaintext ' ,
121
137
fieldsFilled: fieldsFilled
122
138
}
123
139
this .$ga .event ({
@@ -143,20 +159,29 @@ export default {
143
159
}
144
160
</script >
145
161
<style lang="scss">
146
-
147
162
.copyBtn svg {
148
163
margin-right : 3px ;
149
164
}
150
165
151
- #attribution-richtext >p >span ,
152
- #attribution-richtext .photo-license-icons {
153
- height : 26px ;
154
- vertical-align : middle ;
166
+ .attribution-tab .photo-license-icon {
167
+ height : 1.4rem ;
155
168
}
156
- #attribution-richtext p {
169
+
170
+ #attribution-text p {
157
171
margin-top : 0.5rem ;
158
172
margin-bottom : 1rem ;
159
173
}
174
+ #generated-html-container {
175
+ padding-top : 10px ;
176
+ padding-bottom : 10px ;
177
+ }
178
+ #generated-html-container textarea {
179
+ word-break : break-all ;
180
+ -ms-word-break : break-all ;
181
+ min-height : 60px ;
182
+ font-family : Source Sans Pro, Noto Sans, Arial , Helvetica Neue, Helvetica , sans-serif ;
183
+ font-size : .845rem ;
184
+ }
160
185
.license-use-hint {
161
186
text-align : center ;
162
187
}
@@ -205,27 +230,4 @@ export default {
205
230
}
206
231
}
207
232
}
208
- #generated-html-container {
209
- padding-top :10px ;
210
- padding-bottom : 10px ;
211
- textarea {
212
- word-break : break-all ;
213
- -ms-word-break : break-all ;
214
- min-height : 60px ;
215
- font-family : " Source Sans Pro" , " Noto Sans" , Arial , " Helvetica Neue" , Helvetica , sans-serif ;
216
- font-size :0.845rem ;
217
- }
218
- }
219
- #generated-richtext-container {
220
- margin-top : 1rem ;
221
- display : block ;
222
- .attribution-license-icons {
223
- vertical-align : middle ;
224
- margin-top : 0 ;
225
- margin-left : 2px ;
226
- }
227
- p {
228
- display : inline
229
- }
230
- }
231
233
</style >
0 commit comments