Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us also change the exported name to match the filename here

File renamed without changes.
29 changes: 22 additions & 7 deletions src/components/Cards/CreateWiki.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,37 @@
:inFlight="inFlight"
:error="error"
:dismissable="false"
submitButtonText="Create Wiki"
v-model="stepThree"
@previous-step="goToStep(2)"
@submit="createWiki"
/>
<step-four-card
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to include this Step Four in this PR. Implementing a new card isn't due until a later ticket: T419210 and it should be called KnowledgeEquityCreateWikiWizardStep

v-show="step === 4"
:title="title"
:inFlight="inFlight"
:error="error"
:dismissable="false"
v-model="stepThree"
@previous-step="goToStep(3)"
@submit="createWiki"
/>
</v-form>
</template>

<script>
import config from '~/config'
import StepOneCard from './CreateWikiWizardStepOne.vue'
import StepTwoCard from './CreateWikiWizardStepTwo.vue'
import StepThreeCard from './CreateWikiWizardStepThree.vue'
import SiteDetailsCreateWikiWizardStep from './SiteDetailsCreateWikiWizardStep.vue'
import AudienceAndPurposeWizardStep from './AudienceAndPurposeWizardStep.vue'
import TemporalityProfileEditWizardStep from './TemporalityProfileEditWizardStep.vue'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need ...CreateWikiWikiWizardStep components in this CreateWiki card

import TemporalityCreateWikiWizardStep from '@/components/Cards/TemporalityCreateWikiWizardStep.vue'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this @ symbol for importing probably works fine although I haven't tested it. I think we could stick with consistently using the same import type for all cases either ./ or @


export default {
name: 'CreateWiki',
components: {
StepOneCard,
StepTwoCard,
StepThreeCard
StepOneCard: SiteDetailsCreateWikiWizardStep,
StepTwoCard: AudienceAndPurposeWizardStep,
StepThreeCard: TemporalityProfileEditWizardStep,
StepFourCard: TemporalityCreateWikiWizardStep
},
props: [
'title',
Expand Down Expand Up @@ -77,6 +88,10 @@ export default {
temporality: '',
otherTemporality: ''
},
stepFour: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above we don't need a step four yet :)

selectedOption: '',
freeTextResponse: ''
},
hasError: false,
error: [],
inFlight: false,
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us also change the exported name to match the filename here

File renamed without changes.
135 changes: 135 additions & 0 deletions src/components/Cards/TemporalityCreateWikiWizardStep.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<template>
<v-card class="elevation-12">
<v-toolbar dark color="primary">
<v-toolbar-title>{{ title }}</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn v-if="dismissable" icon @click="$emit('close-dialog')">
<v-icon>mdi-close</v-icon>
</v-btn>
</v-toolbar>

<v-card-text>
<v-form ref="inputForm" v-on:submit.prevent>
<h3>How long do you plan to use this Wikibase?</h3>

<v-radio-group
v-model="value.temporality"
:error-messages=error
:rules="[() => !!value.temporality || 'Please select an option.']"
>
<v-radio value="permanent" ref="test">
<template v-slot:label>
I would prefer to keep it on a permanent basis
</template>
</v-radio>
<v-radio value="temporary">
<template v-slot:label>
It is temporary/disposable. I will no longer need it after it served its purpose
</template>
</v-radio>

<v-radio value="other">
<template v-slot:label>
Other: <v-text-field
dense
counter="200"
class="pl-1 mt-n1 mb-n2"
v-model="value.otherTemporality"
:rules="
[
() => value.temporality !== 'other'
|| !! value.otherTemporality
|| 'Please provide a response.',

() => value.temporality !== 'other'
|| !! (value.otherTemporality && value.otherTemporality.length < 201)
|| 'Text must be 200 characters or less.'
]"
></v-text-field>
</template>
</v-radio>
<v-radio value="decide_later">
<template v-slot:label>
I will decide later
</template>
</v-radio>
</v-radio-group>
<h3 class="mt-6">Terms of Use</h3>
<div class="body-2">
Previously accepted
<v-tooltip top>
<template v-slot:activator="{ on }">
<a
target="_blank"
href="/terms-of-use"
@click.stop
v-on="on"
>
Terms of Use</a>
</template>
Opens in new window
</v-tooltip> still apply.
</div>
</v-form>
</v-card-text>
<v-card-actions>
<v-btn
type="button"
:disabled="inFlight"
@click="previousStep"
>
&lt; Previous
</v-btn>

<v-btn
type="button"
color="primary"
:disabled="inFlight"
@click="submitWholeForm"
>
Create Wiki
</v-btn>
</v-card-actions>
</v-card>
</template>

<script>
export default {
name: 'StepFourCard',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us also change the name to match the filename here

props: {
title: String,
inFlight: Boolean,
value: Object,
error: Array,
dismissable: Boolean
},
methods: {
previousStep () {
if (this.value.temporality !== 'other') {
this.value.otherTemporality = undefined
}

this.$emit('previous-step')
},
submitWholeForm () {
if (this.value.temporality !== 'other') {
this.value.otherTemporality = undefined
}

this.$refs.inputForm.validate()
if (this.$refs.inputForm.validate() === true) {
this.$emit('submit')
}
}
}

}
</script>

<style lang="css" scoped>
.v-card__actions {
flex-wrap: wrap;
justify-content: flex-end;
gap: 8px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
:disabled="inFlight"
@click="submitWholeForm"
>
{{ submitButtonText }}
Create Wiki
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now needs to have a different value hardcoded because this component is now designed to be used in the ProfileEdit context. It should have "Set intended use" from https://github.com/wbstack/ui/pull/1105/changes#diff-65f4e79e86b49a3110f6196179d7d13de0b9d84e8cc5b8f42a42de0dbcb98273L24

</v-btn>
</v-card-actions>
</v-card>
Expand All @@ -101,8 +101,7 @@ export default {
inFlight: Boolean,
value: Object,
error: Array,
dismissable: Boolean,
submitButtonText: String
dismissable: Boolean
},
methods: {
previousStep () {
Expand Down
8 changes: 4 additions & 4 deletions src/components/Pages/ManageWiki/Cards/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@

<script>
import Message from '../Features/Message.vue'
import StepTwoCard from '~/components/Cards/CreateWikiWizardStepTwo'
import StepThreeCard from '~/components/Cards/CreateWikiWizardStepThree'
import AudienceAndPurposeWizardStep from '@/components/Cards/AudienceAndPurposeWizardStep.vue'
import TemporalityProfileEditWizardStep from '@/components/Cards/TemporalityProfileEditWizardStep.vue'

const providedResponses = {
purpose: {
Expand All @@ -104,8 +104,8 @@ export default {
name: 'Profile',
components: {
Message,
StepTwoCard,
StepThreeCard
StepTwoCard: AudienceAndPurposeWizardStep,
StepThreeCard: TemporalityProfileEditWizardStep
},
props: [
'wikiId'
Expand Down
Loading