Skip to content

Commit 4b1fe38

Browse files
outdooracorntarrow
andauthored
Create KnowledgeEquityCreateWikiWizardStep Card (#1108)
Create a new `KnowledgeEquityCreateWikiWizardStep` card that is displayed as part of the "Create Wiki Wizard" if the user selects the option to keep their wiki on a permanent basis Bug: T419210 Co-authored-by: Thomas Arrow <thomas.arrow@wikimedia.de>
1 parent d3c3e8a commit 4b1fe38

3 files changed

Lines changed: 158 additions & 20 deletions

File tree

src/components/Cards/CreateWiki.vue

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@
2929
:error="error"
3030
v-model="stepThree"
3131
@previous-step="goToStep(2)"
32+
@next-step="goToStep(4)"
33+
@submit="createWiki"
34+
/>
35+
36+
<KnowledgeEquityCreateWikiWizardStep
37+
v-show="step === 4"
38+
v-model="stepFour"
39+
:title="title"
40+
:inFlight="inFlight"
41+
:error="error"
42+
@previous-step="goToStep(3)"
3243
@submit="createWiki"
3344
/>
3445
</v-form>
@@ -39,13 +50,15 @@ import config from '~/config'
3950
import SiteDetailsCreateWikiWizardStep from './SiteDetailsCreateWikiWizardStep.vue'
4051
import AudienceAndPurposeWizardStep from './AudienceAndPurposeWizardStep.vue'
4152
import TemporalityCreateWikiWizardStep from './TemporalityCreateWikiWizardStep.vue'
53+
import KnowledgeEquityCreateWikiWizardStep from './KnowledgeEquityCreateWikiWizardStep.vue'
4254
4355
export default {
4456
name: 'CreateWiki',
4557
components: {
4658
SiteDetailsCreateWikiWizardStep,
4759
AudienceAndPurposeWizardStep,
48-
TemporalityCreateWikiWizardStep
60+
TemporalityCreateWikiWizardStep,
61+
KnowledgeEquityCreateWikiWizardStep
4962
},
5063
props: [
5164
'title'
@@ -74,6 +87,10 @@ export default {
7487
temporality: '',
7588
otherTemporality: ''
7689
},
90+
stepFour: {
91+
selectedOption: '',
92+
freeTextResponse: ''
93+
},
7794
hasError: false,
7895
error: [],
7996
inFlight: false,
@@ -119,24 +136,30 @@ export default {
119136
domainToSubmit = this.stepOne.domain
120137
}
121138
122-
const profileJSObject = {
139+
const profileObject = {
123140
purpose: this.stepTwo.purpose,
124141
...(this.stepTwo.otherPurpose && { purpose_other: this.stepTwo.otherPurpose }),
125142
...(this.stepTwo.audience && { audience: this.stepTwo.audience }),
126143
...(this.stepTwo.otherAudience && { audience_other: this.stepTwo.otherAudience }),
127144
temporality: this.stepThree.temporality,
128145
...(this.stepThree.otherTemporality && { temporality_other: this.stepThree.otherTemporality })
129146
}
130-
const profileJsonString = JSON.stringify(profileJSObject)
131147
132-
this.$api.createWiki(
133-
{
134-
domain: domainToSubmit,
135-
sitename: this.stepOne.sitename,
136-
username: this.stepOne.username,
137-
profile: profileJsonString
148+
const requestBody = {
149+
domain: domainToSubmit,
150+
sitename: this.stepOne.sitename,
151+
username: this.stepOne.username,
152+
profile: JSON.stringify(profileObject)
153+
}
154+
155+
if (this.stepThree.temporality === 'permanent' && this.stepFour.selectedOption) {
156+
requestBody.knowledgeEquityResponse = {
157+
selectedOption: this.stepFour.selectedOption,
158+
freeTextResponse: this.stepFour.freeTextResponse
138159
}
139-
)
160+
}
161+
162+
this.$api.createWiki(requestBody)
140163
.then(wikiDetails => this.createSuccess(wikiDetails))
141164
.catch(errors => this.createFail(errors))
142165
},
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<template>
2+
<v-card class="elevation-12">
3+
<v-toolbar dark color="primary">
4+
<v-toolbar-title>{{ title }}</v-toolbar-title>
5+
</v-toolbar>
6+
7+
<v-card-text>
8+
<v-form ref="form">
9+
<div class="text-body-1">
10+
We want to
11+
<a href="https://meta.wikimedia.org/wiki/Strategy/Wikimedia_movement/2017#Our_strategic_direction:_Service_and_Equity" target="_blank">
12+
support knowledge equity</a>
13+
in the Wikibase ecosystem and to understand who currently sees their Wikibase contributing towards it.
14+
We welcome open responses and any additional feedback via our <a href="/contact" target="_blank">contact form</a>
15+
in addition to the options provided below.
16+
</div>
17+
<v-radio-group
18+
label="Do you believe that this Wikibase contributes positively to knowledge equity in the Wikibase ecosystem in any way?"
19+
v-model="value.selectedOption"
20+
:error-messages="error"
21+
:rules="[() => !!value.selectedOption || 'Please select an option.']"
22+
>
23+
<template v-slot:label>
24+
<h3>Do you believe that this Wikibase contributes positively to knowledge equity in the Wikibase ecosystem in any way?</h3>
25+
</template>
26+
<v-radio value="yes" label="Yes, I believe it does"/>
27+
<v-radio value="no" label="No, I don't believe it does"/>
28+
<v-radio value="unsure" label="I'm not sure"/>
29+
<v-radio value="unsaid" label="I prefer not to say"/>
30+
</v-radio-group>
31+
32+
<v-textarea
33+
class="mb-2"
34+
outlined
35+
placeholder="If you’d like, please tell us in what way(s). For example, through the knowledge it contributes and/or the people holding and sharing it."
36+
counter="3000"
37+
v-model="value.freeTextResponse"
38+
:rules="[() => value.freeTextResponse.length <= 3000 || 'Text must be 3000 characters or less.' ]"
39+
/>
40+
<v-alert
41+
outlined
42+
text
43+
type="warning"
44+
icon="mdi-alert-outline"
45+
>
46+
Please avoid sharing any personal or sensitive information. This information will be visible to WMDE employees and external members of the
47+
<a href="https://www.mediawiki.org/wiki/Wikibase/Wikibase.cloud/Hosting_policy_draft_v0.1#4.7_Review_Committee" target="_blank">review committee</a>.
48+
</v-alert>
49+
</v-form>
50+
</v-card-text>
51+
52+
<v-card-actions>
53+
<v-btn
54+
type="button"
55+
:disabled="inFlight"
56+
@click="previousStep"
57+
>
58+
&lt; Previous
59+
</v-btn>
60+
<v-btn
61+
type="button"
62+
color="primary"
63+
:disabled="inFlight"
64+
@click="submitForm"
65+
>
66+
Create Wiki
67+
</v-btn>
68+
</v-card-actions>
69+
</v-card>
70+
</template>
71+
72+
<script>
73+
export default {
74+
name: 'KnowledgeEquityCreateWikiWizardStep',
75+
props: {
76+
title: String,
77+
inFlight: Boolean,
78+
value: Object,
79+
error: Array
80+
},
81+
methods: {
82+
previousStep () {
83+
this.$emit('previous-step')
84+
},
85+
submitForm () {
86+
if (this.$refs.form.validate() === false) {
87+
return
88+
}
89+
90+
this.$emit('submit')
91+
}
92+
}
93+
}
94+
</script>
95+
96+
<style lang="css" scoped>
97+
.v-card__actions {
98+
flex-wrap: wrap;
99+
justify-content: flex-end;
100+
gap: 8px;
101+
}
102+
</style>

src/components/Cards/TemporalityCreateWikiWizardStep.vue

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@
8181
type="button"
8282
color="primary"
8383
:disabled="inFlight"
84-
@click="submitWholeForm"
84+
@click="primaryBtnAction"
8585
>
86-
Create Wiki
86+
{{primaryBtnLabel}}
8787
</v-btn>
8888
</v-card-actions>
8989
</v-card>
@@ -98,26 +98,39 @@ export default {
9898
value: Object,
9999
error: Array
100100
},
101+
computed: {
102+
primaryBtnLabel () {
103+
if (this.value.temporality === 'permanent') {
104+
return 'Next >'
105+
} else {
106+
return 'Create Wiki'
107+
}
108+
}
109+
},
101110
methods: {
102-
previousStep () {
111+
primaryBtnAction () {
103112
if (this.value.temporality !== 'other') {
104113
this.value.otherTemporality = undefined
105114
}
106115
107-
this.$emit('previous-step')
116+
if (this.$refs.inputForm.validate() === false) {
117+
return
118+
}
119+
120+
if (this.value.temporality === 'permanent') {
121+
this.$emit('next-step')
122+
} else {
123+
this.$emit('submit')
124+
}
108125
},
109-
submitWholeForm () {
126+
previousStep () {
110127
if (this.value.temporality !== 'other') {
111128
this.value.otherTemporality = undefined
112129
}
113130
114-
this.$refs.inputForm.validate()
115-
if (this.$refs.inputForm.validate() === true) {
116-
this.$emit('submit')
117-
}
131+
this.$emit('previous-step')
118132
}
119133
}
120-
121134
}
122135
</script>
123136

0 commit comments

Comments
 (0)