Skip to content

Commit

Permalink
openが変更された時のみ警告を表示するように
Browse files Browse the repository at this point in the history
  • Loading branch information
mathsuky committed Jan 6, 2024
1 parent 60b02ec commit 1ceb224
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/components/event/EventFormBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</v-stepper-content>

<v-stepper-content step="3">
<event-form-summary v-bind="{ ...summary, content }" />
<event-form-summary v-bind="{ ...summary, content, isEdit: isEdit }" />
<form-back-button class="mr-2" @click="step = 2">
Back
</form-back-button>
Expand Down Expand Up @@ -108,6 +108,9 @@ enum TimeAndPlaceFormTab {
},
})
export default class EventFormBase extends Vue {
@Prop({ type: Boolean, required: true })
isEdit!: boolean
@Prop({ type: Object })
event!: EventInput | null | undefined
Expand Down
16 changes: 14 additions & 2 deletions src/components/event/EventFormSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
<span class="text-h6 ml-2">{{ openString }}</span>
</SummaryItemText>
<v-alert
v-if="!open"
v-if="!open && isEdit && openChanged()"
border="left"
colored-border
type="warning"
elevation="1"
class="mt-3"
>
この設定にすると,グループ外の参加者の情報が存在すれば全て削除されます
グループ外の参加者を許可しない場合、既に登録されているグループ外の参加者の参加情報は削除されます
</v-alert>
</SummaryItem>
<SummaryItem>
Expand Down Expand Up @@ -158,8 +158,12 @@ export default class EventFormSummary extends Vue {
@Prop({ type: Boolean, required: true })
sharedRoom!: boolean
@Prop({ type: Boolean, required: true })
isEdit!: boolean
page: number = 1
inviteesPerPage: number = 6
originalOpen: boolean = null!
get sharedRoomString(): string {
return this.sharedRoom ? '部屋の共用可能' : '部屋の共用不可能'
Expand Down Expand Up @@ -203,5 +207,13 @@ export default class EventFormSummary extends Vue {
this.page * this.inviteesPerPage
)
}
openChanged(): boolean {
return this.originalOpen !== this.open
}
created() {
this.originalOpen = this.open
}
}
</script>
6 changes: 5 additions & 1 deletion src/pages/EventEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
</span>
</template>
<template v-else>
<event-form-base class="mb-5" :event="event" @submit="submit" />
<event-form-base
class="mb-5"
v-bind="{ event, isEdit: true }"
@submit="submit"
/>

<v-card class="px-5 pt-5 pb-3">
<span class="headline mr-3"> Delete this event </span>
Expand Down
6 changes: 5 additions & 1 deletion src/pages/EventNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
<progress-circular v-if="status === 'loading'" />
<load-failed-text v-else-if="status === 'error'" />
<template v-else>
<event-form-base :event="event" @submit="submit" />
<event-form-base
class="mb-5"
v-bind="{ event, isEdit: false }"
@submit="submit"
/>
</template>
</v-container>
</template>
Expand Down

0 comments on commit 1ceb224

Please sign in to comment.