Skip to content

Commit 6ba8dec

Browse files
committed
Fix Stepper first label not shown bug
The label for first step depends on currently selected license: it's set to Attribution if it's a 'BY' license and 'Public Domain' if 'CC0' is selected. When the label was based on computed property translated by i18n, the label didn't change. So, the change was moved to a method. Signed-off-by: Olga Bulat <obulat@gmail.com>
1 parent 6d349cf commit 6ba8dec

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/components/Stepper.vue

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
ref="steps"
1313
>
1414
<b-step-item
15-
v-for="item in this.steps"
15+
v-for="(item, index) in this.steps"
1616
:icon-pack="item['icon-pack']"
1717
:icon="getIcon(item.shortName)"
18-
:label=$t(item.label)
18+
:label="$t(labels[index])"
1919
:key="item.shortName"
2020
:selected="isStepSelected(item.shortName)"
2121
:visible="isStepVisible(item.shortName)"
@@ -62,37 +62,31 @@ export default {
6262
currentStep: 0,
6363
steps: [
6464
{
65-
label: this.attributionName,
6665
shortName: 'BY',
6766
'icon-pack': 'fab',
6867
itemType: 'licenseAttribute'
6968
},
7069
{
71-
label: 'stepper-label.NonCommercial',
7270
shortName: 'NC',
7371
'icon-pack': 'fab',
7472
itemType: 'licenseAttribute'
7573
},
7674
{
77-
label: 'stepper-label.NoDerivatives',
7875
shortName: 'ND',
7976
'icon-pack': 'fab',
8077
itemType: 'licenseAttribute'
8178
},
8279
{
83-
label: 'stepper-label.Share-Alike',
8480
shortName: 'SA',
8581
'icon-pack': 'fab',
8682
itemType: 'licenseAttribute'
8783
},
8884
{
89-
label: 'stepper-label.CopyrightWaiver',
9085
shortName: 'wv',
9186
'icon-pack': 'fas',
9287
itemType: 'CC0Attribute'
9388
},
9489
{
95-
label: 'stepper-label.AttributionDetails',
9690
shortName: 'ad',
9791
'icon-pack': 'fas',
9892
itemType: 'AttributionDetails'
@@ -107,8 +101,17 @@ export default {
107101
attributionIcon() {
108102
return this.$props.value.shortName.includes('BY') ? 'creative-commons-by' : 'creative-commons-zero'
109103
},
110-
attributionName() {
111-
return this.$props.value.shortName.includes('BY') ? 'stepper-label.Attribution' : 'stepper-label.PublicDomain'
104+
labels() {
105+
const attributionStepLabel = this.$props.value.shortName.includes('BY') ? 'Attribution' : 'PublicDomain'
106+
const stepLabels = [
107+
`stepper-label.${attributionStepLabel}`,
108+
'stepper-label.NoDerivatives',
109+
'stepper-label.NonCommercial',
110+
'stepper-label.Share-Alike',
111+
'stepper-label.CopyrightWaiver',
112+
'stepper-label.AttributionDetails'
113+
]
114+
return stepLabels
112115
}
113116
},
114117
methods: {
@@ -130,6 +133,9 @@ export default {
130133
return `creative-commons-${attrName.toLowerCase()}`
131134
}
132135
},
136+
getAttributionName() {
137+
return this.$props.value.shortName.includes('BY') ? 'stepper-label.Attribution' : 'stepper-label.PublicDomain'
138+
},
133139
updateLicense(itemId) {
134140
const attrs = { ...this.licenseAttributes }
135141
attrs[itemId] = !attrs[itemId]

0 commit comments

Comments
 (0)