Skip to content

Commit 5b8af35

Browse files
committed
Update Vuex and Stepper data handling
Set ND and NC steps as reversed, so that selecting 'No' actually sets the state as selected (due to change in question wording from negative to positive). Remove unnecessary getters from Vuex. Show CopyrightWaiverStep if CC0 is selected from Dropdown. Make only previous step headings clickable, so that user doesn't skip steps. Unify handling of selection/deselection for different types of steps. Signed-off-by: Olga Bulat <obulat@gmail.com>
1 parent b070efd commit 5b8af35

File tree

10 files changed

+241
-100
lines changed

10 files changed

+241
-100
lines changed

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</div>
1313
</div>
1414
<div class="columns">
15-
<Stepper v-model="currentStepId" />
15+
<Stepper />
1616
<div class="column" >
1717
<div class="fixed-right-column">
1818
<SelectedLicenseCard

src/components/AttributionDetailsStep.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default {
4040
...mapMutations(['setCreatorName', 'setCreatorProfileUrl', 'setWorkTitle', 'setWorkUrl'])
4141
},
4242
computed: {
43-
...mapState({ attributionDetails: state => state.attributionDetails }),
43+
...mapState(['attributionDetails']),
4444
creatorName: {
4545
get() { return this.attributionDetails.creatorName },
4646
set(newVal) {

src/components/CopyrightWaiverStep.vue

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,60 @@
11
<template>
22
<div>
3-
<b-checkbox>
4-
{{$t('stepper.CW.copyright-waive-agreement')}}
5-
</b-checkbox>
6-
<textarea :value="this.$t('cc0-waiver.text')" :class="'waiver-textarea'" />
7-
<b-checkbox>
8-
{{$t("stepper.CW.copyright-waive-confirmation")}}
9-
</b-checkbox>
3+
<div class="step-description vocab-body body-normal"
4+
v-if="this.status==='previous'">
5+
<p class="vocab-body body-normal">{{$t('stepper.CW.selected')}}</p>
6+
</div>
7+
<div class="step-actions" v-else-if="this.status==='current'">
8+
<b-checkbox v-model="copyrightWaiverAgreed">
9+
{{$t('stepper.CW.copyright-waive-agreement')}}
10+
</b-checkbox>
11+
<textarea :value="this.$t('cc0-waiver.text')" :class="'waiver-textarea'" />
12+
<b-checkbox v-model="copyrightWaiverConfirmed">
13+
{{$t("stepper.CW.copyright-waive-confirmation")}}
14+
</b-checkbox>
15+
</div>
1016
</div>
1117
</template>
1218

1319
<script>
1420
export default {
1521
name: 'CopyrightWaiverStep',
16-
props: ['value']
22+
props: {
23+
stepId: Number,
24+
stepName: String,
25+
selected: Boolean,
26+
status: String
27+
},
28+
data() {
29+
return {
30+
agreed: false,
31+
confirmed: false
32+
}
33+
},
34+
computed: {
35+
copyrightWaiverAgreed: {
36+
get() {
37+
return this.agreed
38+
},
39+
set() {
40+
this.agreed = !this.agreed
41+
if (this.agreed && this.confirmed) {
42+
this.$emit('change', this.$props.stepName, this.$props.stepId, true)
43+
}
44+
}
45+
},
46+
copyrightWaiverConfirmed: {
47+
get() {
48+
return this.confirmed
49+
},
50+
set() {
51+
this.confirmed = !this.confirmed
52+
if (this.agreed && this.confirmed) {
53+
this.$emit('change', this.$props.stepName, this.$props.stepId, true)
54+
}
55+
}
56+
}
57+
}
1758
}
1859
</script>
1960

src/components/DropdownStep.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{{cardText}}
55
</div>
66
<div class="step-actions" v-else-if="this.status==='current'">
7-
<LicenseDropdown />
7+
<LicenseDropdown @input="updateSelected" />
88
</div>
99
</div>
1010

@@ -17,7 +17,13 @@ export default {
1717
name: 'DropdownStep',
1818
components: { LicenseDropdown },
1919
props: {
20-
status: String
20+
status: String,
21+
stepId: Number
22+
},
23+
methods: {
24+
updateSelected() {
25+
this.$emit('input', 'DD', this.$props.stepId, true)
26+
}
2127
},
2228
computed: {
2329
...mapGetters(['fullName']),

src/components/FirstStep.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default {
4141
}
4242
},
4343
set(newVal) {
44-
this.$emit('change', newVal === 'yes')
44+
this.$emit('change', 'FS', 0, newVal === 'yes')
4545
}
4646
},
4747
yesText() {

src/components/LicenseDropdown.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default {
3636
methods: {
3737
setCurrentLicense(currentLicense) {
3838
this.$store.commit('updateAttributesFromShort', currentLicense)
39+
this.$emit('input')
3940
if (process.env.NODE_ENV === 'production') {
4041
this.$ga.event({
4142
eventCategory: 'LicenseDropdown',

src/components/Step.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<div>
3-
<div class="step-description vocab-body body-normal" v-if="this.status==='previous'">
3+
<div class="step-description vocab-body body-normal"
4+
v-if="this.status==='previous'||this.showDisabledDue">
45
<p class="vocab-body body-normal">{{$t(cardText)}}</p>
56
</div>
67
<div class="step-actions" v-else-if="this.status==='current'">
@@ -29,13 +30,23 @@ export default {
2930
selected: Boolean,
3031
stepId: Number,
3132
status: String,
32-
reversed: Boolean
33+
reversed: Boolean,
34+
enabled: Boolean,
35+
disabledDue: String
3336
},
3437
computed: {
38+
showDisabledDue() {
39+
return !this.$props.enabled && this.$props.disabledDue !== undefined
40+
},
3541
qualifier() {
3642
return this.reversed ? !this.selected : this.selected
3743
},
3844
cardText() {
45+
if (this.$props.enabled === false) {
46+
return this.$props.disabledDue === 'ND'
47+
? 'stepper.disabled-text-ND'
48+
: 'stepper.disabled-text'
49+
}
3950
const prefix = `stepper.${this.$props.stepName}.${this.qualifier ? '' : 'not-'}`
4051
return `${prefix}selected`
4152
},

0 commit comments

Comments
 (0)