Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find a solution for the deletion redirect problem #4975

Draft
wants to merge 4 commits into
base: devel
Choose a base branch
from
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
53 changes: 48 additions & 5 deletions frontend/src/components/activity/ScheduleEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,15 @@
<template v-else>
<!-- Header -->
<v-row dense class="activity-header">
<v-col class="col col-sm-6 col-12 px-0 pt-0">
<v-col class="col col-sm-6 col-12 px-0 pt-0 d-flex flex-wrap gap-x-4">
<table>
<thead>
<tr>
<th scope="col" class="text-right pb-2 pr-4">
<th
v-if="category.numberingStyle !== '-'"
scope="col"
class="text-right pb-2 pr-4"
>
{{ $tc('entity.scheduleEntry.fields.nr') }}
</th>
<th scope="col" class="text-left pb-2 pr-4">
Expand All @@ -184,8 +188,20 @@
v-for="scheduleEntryItem in scheduleEntries"
:key="scheduleEntryItem._meta.self"
>
<th class="text-right tabular-nums pb-2 pr-4">
{{ scheduleEntryItem.number }}
<th
v-if="category.numberingStyle !== '-'"
class="text-right tabular-nums pb-2 pr-4"
>
<RouterLink
v-if="scheduleEntryItem._meta.self !== scheduleEntry()._meta.self"
:to="scheduleEntryRoute(scheduleEntryItem)"
class="e-title-link"
>
{{ scheduleEntryItem.number }}
</RouterLink>
<template v-else>
{{ scheduleEntryItem.number }}
</template>
</th>
<td class="text-left tabular-nums pb-2 pr-4">
{{
Expand All @@ -196,11 +212,33 @@
{{ dateShort(scheduleEntryItem.start) }}
</td>
<td class="text-left tabular-nums pb-2 pr-0">
{{ rangeLongEnd(scheduleEntryItem.start, scheduleEntryItem.end) }}
<RouterLink
v-if="
category.numberingStyle === '-' &&
scheduleEntryItem._meta.self !== scheduleEntry()._meta.self
"
:to="scheduleEntryRoute(scheduleEntryItem)"
class="e-title-link"
>
{{ rangeLongEnd(scheduleEntryItem.start, scheduleEntryItem.end) }}
</RouterLink>
<template v-else>
{{ rangeLongEnd(scheduleEntryItem.start, scheduleEntryItem.end) }}
</template>
</td>
</tr>
</tbody>
</table>
<DialogActivityEdit
v-if="activity && isContributor"
:schedule-entry="scheduleEntry()"
hide-header-fields
@activityUpdated="activity.$reload()"

Check warning on line 236 in frontend/src/components/activity/ScheduleEntry.vue

View workflow job for this annotation

GitHub Actions / Lint: Frontend (ESLint)

v-on event '@activityUpdated' must be hyphenated
>
<template #activator="{ on }">
<ButtonEdit text small class="v-btn--has-bg" v-on="on" />
</template>
</DialogActivityEdit>
</v-col>
<v-col class="col col-sm-6 col-12 px-0">
<api-form :entity="activity" name="activity">
Expand Down Expand Up @@ -264,10 +302,14 @@
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/activity/dialog/DialogActivityEdit.vue'

export default {
name: 'ScheduleEntry',
components: {
DialogActivityEdit,
ButtonEdit,
ApiForm,
ApiSelect,
TogglePaperSize,
Expand Down Expand Up @@ -390,6 +432,7 @@
this.$toast.error(errorToMultiLineToast(e))
})
},
scheduleEntryRoute,
countContentNodes(contentType) {
return this.contentNodes.items.filter((cn) => {
return cn.contentType().id === contentType.id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<dialog-form
v-model="showDialog"
:title="$tc('components.program.dialogActivityEdit.title')"

Check failure on line 4 in frontend/src/components/activity/dialog/DialogActivityEdit.vue

View workflow job for this annotation

GitHub Actions / Lint: Frontend (ESLint)

Translation key `components.program.dialogActivityEdit.title` should start with `components.activity.dialog.dialogActivityEdit.`, based on file path `components/activity/dialog/DialogActivityEdit`
:loading="loading"
:error="error"
icon="mdi-calendar-plus"
Expand All @@ -15,30 +15,32 @@
<slot name="activator" v-bind="scope" />
</template>
<template #moreActions>
<v-btn
v-if="!scheduleEntry.tmpEvent"
color="primary"
:to="scheduleEntryRoute(scheduleEntry)"
>
{{ $tc('global.button.open') }}
</v-btn>
<slot name="moreActions" />
</template>
<dialog-activity-form :activity="entityData" :period="scheduleEntry.period()" />
<DialogActivityForm
:activity="entityData"
:current-schedule-entry="scheduleEntry"
:period="scheduleEntry.period"
:hide-location="hideHeaderFields"
/>
</dialog-form>
</template>

<script>
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: true },
hideHeaderFields: {
type: Boolean,
default: false,
},
},
data() {
return {
Expand All @@ -47,12 +49,12 @@
}
},
computed: {
scheduleEntries() {
return this.activity.scheduleEntries()
},
activity() {
return this.scheduleEntry.activity()
},
scheduleEntries() {
return this.activity.scheduleEntries()
},
},
watch: {
showDialog: async function (showDialog) {
Expand Down Expand Up @@ -113,6 +115,9 @@

// patch activity entity
const activityPayload = { ...this.entityData }
if (this.hideHeaderFields) {
delete activityPayload.location
}
delete activityPayload.scheduleEntries
promises.push(this.api.patch(this.entityUri, activityPayload))

Expand All @@ -128,7 +133,6 @@
this.close()
this.$emit('activity-updated', data)
},
scheduleEntryRoute,
},
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@
</template>
</e-select>

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

<FormScheduleEntryList
v-if="activity.scheduleEntries"
:schedule-entries="activity.scheduleEntries"
:current-schedule-entry="currentScheduleEntry"
:period="period"
:periods="camp.periods().items"
/>
Expand Down Expand Up @@ -69,10 +70,18 @@ export default {
type: Object,
required: true,
},
currentScheduleEntry: {
type: Object,
required: true,
},
autoselectTitle: {
type: Boolean,
default: false,
},
hideLocation: {
type: Boolean,
default: false,
},
},
data() {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</v-col>

<v-col cols="1" class="pt-3 text-center">
<button-delete v-if="!isLastItem" icon-only @click="$emit('delete')" />
<button-delete v-if="deletable" icon-only @click="$emit('delete')" />
</v-col>
</v-row>
</v-container>
Expand Down Expand Up @@ -82,9 +82,9 @@ export default {
},

// true if current item is the last scheduleEntry
isLastItem: {
deletable: {
type: Boolean,
required: true,
required: false,
},
},
data() {
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 All @@ -22,7 +22,11 @@
class="transition-list-item pa-0 mb-4"
:schedule-entry="scheduleEntry"
:periods="periods"
:is-last-item="scheduleEntriesWithoutDeleted.length === 1"
:deletable="
scheduleEntriesWithoutDeleted.length > 1 &&
($route.name !== 'activity' ||
scheduleEntry.self !== currentScheduleEntry._meta.self)
"
@delete="deleteEntry(scheduleEntry)"
/>
</transition-group>
Expand All @@ -47,6 +51,11 @@ export default {
required: true,
},

currentScheduleEntry: {
type: Object,
required: true,
},

// all available periods
periods: {
type: Array,
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
Loading
Loading