Skip to content

Commit

Permalink
Move activity edit dialogs and simplify props
Browse files Browse the repository at this point in the history
(cherry picked from commit e726a7f)
  • Loading branch information
manuelmeister committed Dec 25, 2024
1 parent e493e2f commit 6d05474
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 36 deletions.
1 change: 1 addition & 0 deletions common/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@
"endDate": "Enddatum",
"endDatetime": "Endzeit",
"nr": "Nr.",
"start": "Start",
"startDate": "Startdatum",
"startDatetime": "Startzeit",
"time": "Zeitpunkt"
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/activity/ScheduleEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ Displays a single scheduleEntry
</table>
<DialogActivityEdit
v-if="activity && isContributor"
:period="scheduleEntry().period"
:activity="activity"
:schedule-entry="scheduleEntry"
hide-header-fields
@activityUpdated="activity.$reload()"
>
<template #activator="{ on }">
<ButtonEdit text small class="v-btn--has-bg" v-on="on" />
Expand Down Expand Up @@ -275,7 +275,7 @@ import TogglePaperSize from '@/components/activity/TogglePaperSize.vue'
import ApiForm from '@/components/form/api/ApiForm.vue'
import ApiSelect from '@/components/form/api/ApiSelect.vue'
import ButtonEdit from '@/components/buttons/ButtonEdit.vue'
import DialogActivityEdit from '@/components/program/DialogActivityEdit.vue'
import DialogActivityEdit from '@/components/activity/dialog/DialogActivityEdit.vue'

export default {
name: 'ScheduleEntry',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,12 @@
<template #activator="scope">
<slot name="activator" v-bind="scope" />
</template>
<template v-if="scheduleEntry" #moreActions>
<v-btn
v-if="!scheduleEntry.tmpEvent"
color="primary"
:to="scheduleEntryRoute(scheduleEntry)"
>
{{ $tc('global.button.open') }}
</v-btn>
<template #moreActions>
<slot name="moreActions" />
</template>
<DialogActivityForm
:activity="entityData"
:period="currentPeriod"
:period="scheduleEntry.period"
:hide-location="hideHeaderFields"
/>
</dialog-form>
Expand All @@ -35,16 +29,13 @@
import DialogForm from '@/components/dialog/DialogForm.vue'
import DialogBase from '@/components/dialog/DialogBase.vue'
import DialogActivityForm from './DialogActivityForm.vue'
import { scheduleEntryRoute } from '@/router.js'
export default {
name: 'DialogActivityEdit',
components: { DialogForm, DialogActivityForm },
extends: DialogBase,
props: {
scheduleEntry: { type: Object, required: false, default: null },
activity: { type: Object, required: false, default: null },
period: { type: Function, required: false, default: null },
scheduleEntry: { type: Object, required: true },
hideHeaderFields: {
type: Boolean,
default: false,
Expand All @@ -57,20 +48,17 @@ export default {
}
},
computed: {
scheduleEntries() {
return this.currentActivity.scheduleEntries()
},
currentPeriod() {
return this.period || this.scheduleEntry.period
activity() {
return this.scheduleEntry.activity()
},
currentActivity() {
return this.activity || this.scheduleEntry.activity()
scheduleEntries() {
return this.activity.scheduleEntries()
},
},
watch: {
showDialog: async function (showDialog) {
if (showDialog) {
this.loadEntityData(this.currentActivity._meta.self)
this.loadEntityData(this.activity._meta.self)
const scheduleEntries = await this.scheduleEntries.$loadItems()
this.$set(
Expand Down Expand Up @@ -120,7 +108,7 @@ export default {
period: entry.period()._meta.self,
start: entry.start,
end: entry.end,
activity: this.currentActivity._meta.self,
activity: this.activity._meta.self,
})
})
Expand All @@ -144,7 +132,6 @@ export default {
this.close()
this.$emit('activity-updated', data)
},
scheduleEntryRoute,
},
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</template>
</e-select>

<e-text-fieldv-if="!hideLocation" v-model="localActivity.location" path="location" />
<e-text-field v-if="!hideLocation" v-model="localActivity.location" path="location" />

<FormScheduleEntryList
v-if="activity.scheduleEntries"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<v-row no-gutters>
<v-col class="header mb-3">
<legend class="pa-2 float-left">
{{ $tc('components.program.formScheduleEntryList.name') }}
{{ $tc('components.activity.dialog.formScheduleEntryList.name') }}
</legend>

<button-add
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/program/DialogActivityCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<script>
import DialogForm from '@/components/dialog/DialogForm.vue'
import DialogBase from '@/components/dialog/DialogBase.vue'
import DialogActivityForm from './DialogActivityForm.vue'
import DialogActivityForm from '@/components/activity/dialog/DialogActivityForm.vue'
import CopyActivityInfoDialog from '@/components/activity/CopyActivityInfoDialog.vue'
import PopoverPrompt from '@/components/prompt/PopoverPrompt.vue'
import { uniqueId } from 'lodash'
Expand All @@ -125,9 +125,6 @@ export default {
extends: DialogBase,
props: {
scheduleEntry: { type: Object, required: true },
// currently visible period
period: { type: Object, required: true },
},
data() {
return {
Expand All @@ -145,6 +142,9 @@ export default {
camp() {
return this.period.camp()
},
period() {
return this.scheduleEntry.period
},
clipboardAccessDenied() {
return (
this.clipboardPermission === 'unaccessable' ||
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/components/program/ScheduleEntries.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
:reload-entries="reloadScheduleEntries"
:on="eventHandlers"
/>
<dialog-activity-create
<DialogActivityCreate
ref="dialogActivityCreate"
:period="period"
:schedule-entry="newScheduleEntry"
@activity-created="afterCreateActivity($event)"
/>
Expand All @@ -32,7 +31,7 @@
</template>

<script>
import DialogActivityCreate from './DialogActivityCreate.vue'
import DialogActivityCreate from '@/components/program/DialogActivityCreate.vue'
export default {
name: 'ScheduleEntries',
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/components/program/picasso/PicassoEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
<v-icon x-small color="white">mdi-pencil</v-icon>
</v-btn>
</template>
<template #moreActions>
<v-btn color="primary" :to="scheduleEntryRoute">
{{ $tc('global.button.open') }}
</v-btn>
</template>
</DialogActivityEdit>

<h4 class="e-picasso-entry__title">
Expand Down Expand Up @@ -129,7 +134,7 @@
</template>
<script>
import { ref, toRefs, computed } from 'vue'
import DialogActivityEdit from '../DialogActivityEdit.vue'
import DialogActivityEdit from '@/components/activity/dialog/DialogActivityEdit.vue'
import campCollaborationDisplayName from '@/common/helpers/campCollaborationDisplayName.js'
import { timestampToUtcString } from './dateHelperVCalendar.js'
import { dateHelperUTCFormatted } from '@/mixins/dateHelperUTCFormatted.js'
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
"granted": "Du kannst nun kopierte Aktivitäten einfügen.",
"title": "Aktivität kopieren & einfügen"
},
"dialog": {
"dialogActivityEdit": {
"title": "Aktivität bearbeiten"
},
"formScheduleEntryList": {
"name": "Geplante Termine"
}
},
"menuCardlessContentNode": {
"deletingDisabled": "Muss leer sein zum Löschen"
},
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
"granted": "You can now paste copied activities.",
"title": "Copy & paste activity"
},
"dialog": {
"dialogActivityEdit": {
"title": "Edit activity"
},
"formScheduleEntryList": {
"name": "Scheduled"
}
},
"menuCardlessContentNode": {
"deletingDisabled": "Must be empty to delete"
},
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
"copyActivityInfoDialog": {
"allow": "Consenti ora"
},
"dialog": {
"dialogActivityEdit": {
"title": "Modificare l'actività"
},
"formScheduleEntryList": {
"name": "Programmato"
}
},
"menuCardlessContentNode": {
"deletingDisabled": "Deve essere vuoto per essere eliminato"
},
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/locales/rm.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
}
}
},
"dialog": {
"dialogActivityEdit": {
"title": "Modifitgar l'activitad"
},
"formScheduleEntryList": {
"name": "Termins planisads"
}
},
"menuCardlessContentNode": {
"deletingDisabled": "Sto esser vid per stizzar"
},
Expand Down

0 comments on commit 6d05474

Please sign in to comment.