From b871f1a6158814ac9b0b77547834a83e7ebdb97e Mon Sep 17 00:00:00 2001 From: Manuel Meister Date: Sat, 30 Dec 2023 13:17:33 +0100 Subject: [PATCH 01/18] Lock category template editing to manager --- frontend/src/components/activity/DraggableContentNodes.vue | 2 +- .../src/components/activity/content/layout/ContentNodeCard.vue | 2 +- frontend/src/views/activity/Category.vue | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/activity/DraggableContentNodes.vue b/frontend/src/components/activity/DraggableContentNodes.vue index ce4c05f14a..eb5db8e3c3 100644 --- a/frontend/src/components/activity/DraggableContentNodes.vue +++ b/frontend/src/components/activity/DraggableContentNodes.vue @@ -40,7 +40,7 @@ @@ -53,6 +54,7 @@ import ContentCard from '@/components/layout/ContentCard.vue' import RootNode from '@/components/activity/RootNode.vue' import CategoryChip from '@/components/generic/CategoryChip.vue' +import { campRoleMixin } from '@/mixins/campRoleMixin.js' export default { name: 'Category', @@ -61,6 +63,7 @@ export default { ContentCard, RootNode, }, + mixins: [campRoleMixin], provide() { return { preferredContentTypes: () => this.preferredContentTypes, From c8aa1af08096e9682a799a61512d1ab0426ec291 Mon Sep 17 00:00:00 2001 From: Manuel Meister Date: Sat, 30 Dec 2023 13:38:59 +0100 Subject: [PATCH 02/18] Use generic message for entity deletion --- .../src/components/dialog/DialogEntityDelete.vue | 7 ++++++- .../src/components/prompt/PromptEntityDelete.vue | 14 +++++++++----- frontend/src/locales/de.json | 9 +++++---- frontend/src/locales/en.json | 9 +++++---- frontend/src/locales/fr.json | 9 +++++---- frontend/src/locales/it.json | 9 +++++---- frontend/src/locales/rm.json | 9 +++++---- 7 files changed, 40 insertions(+), 26 deletions(-) diff --git a/frontend/src/components/dialog/DialogEntityDelete.vue b/frontend/src/components/dialog/DialogEntityDelete.vue index 7f6e4bf5b2..b2d54d9932 100644 --- a/frontend/src/components/dialog/DialogEntityDelete.vue +++ b/frontend/src/components/dialog/DialogEntityDelete.vue @@ -15,7 +15,11 @@ - {{ $tc('components.dialog.dialogEntityDelete.warningText') }} + {{ + $tc('global.warning.delete', warningTextEntity ? 2 : 0, { + entity: warningTextEntity, + }) + }} - {{ - $tc('components.prompt.promptEntityDelete.warningText', warningTextEntity ? 2 : 0, { - entity: warningTextEntity, - }) - }} + +

+ {{ + $tc('global.warning.delete', warningTextEntity ? 2 : 0, { + entity: warningTextEntity, + }) + }} +

+
@@ -20,10 +39,17 @@ import DialogBase from '@/components/dialog/DialogBase.vue' import DialogForm from '@/components/dialog/DialogForm.vue' import DialogActivityProgressLabelForm from './DialogActivityProgressLabelForm.vue' +import PromptEntityDelete from '@/components/prompt/PromptEntityDelete.vue' +import ErrorExistingActivitiesList from '@/components/campAdmin/ErrorExistingActivitiesList.vue' export default { name: 'DialogActivityProgressLabelEdit', - components: { DialogForm, DialogActivityProgressLabelForm }, + components: { + ErrorExistingActivitiesList, + PromptEntityDelete, + DialogForm, + DialogActivityProgressLabelForm, + }, extends: DialogBase, props: { progressLabel: { type: Object, required: true }, @@ -33,6 +59,16 @@ export default { entityProperties: ['title'], } }, + computed: { + camp() { + return this.progressLabel.camp() + }, + activitiesWithProgressLabel() { + return this.camp.activities().items.filter((activity) => { + return activity.progressLabel?.()._meta.self === this.progressLabel._meta.self + }) + }, + }, watch: { // copy data whenever dialog is opened showDialog: function (showDialog) { diff --git a/frontend/src/components/campAdmin/ErrorExistingActivitiesList.vue b/frontend/src/components/campAdmin/ErrorExistingActivitiesList.vue new file mode 100644 index 0000000000..dcc1ed139a --- /dev/null +++ b/frontend/src/components/campAdmin/ErrorExistingActivitiesList.vue @@ -0,0 +1,55 @@ + + + + diff --git a/frontend/src/components/form/api/ApiSortable.vue b/frontend/src/components/form/api/ApiSortable.vue index b940594861..c38a2873c7 100644 --- a/frontend/src/components/form/api/ApiSortable.vue +++ b/frontend/src/components/form/api/ApiSortable.vue @@ -1,19 +1,23 @@ @@ -54,11 +83,14 @@ import ContentCard from '@/components/layout/ContentCard.vue' import RootNode from '@/components/activity/RootNode.vue' import CategoryChip from '@/components/generic/CategoryChip.vue' +import DialogEntityDelete from '@/components/dialog/DialogEntityDelete.vue' import { campRoleMixin } from '@/mixins/campRoleMixin.js' - +import ErrorExistingActivitiesList from '@/components/campAdmin/ErrorExistingActivitiesList.vue' export default { name: 'Category', components: { + ErrorExistingActivitiesList, + DialogEntityDelete, CategoryChip, ContentCard, RootNode, @@ -68,10 +100,14 @@ export default { return { preferredContentTypes: () => this.preferredContentTypes, allContentNodes: () => this.contentNodes, - camp: () => this.camp, + camp: () => this.camp(), } }, props: { + camp: { + type: Function, + required: true, + }, category: { type: Function, required: true, @@ -84,9 +120,6 @@ export default { } }, computed: { - camp() { - return this.category().camp() - }, contentNodes() { return this.category().contentNodes() }, @@ -102,6 +135,18 @@ export default { await this.category().$reload() // reload as single entity to ensure all embedded entities are included in a single network request this.loading = false }, + methods: { + findActivities(category) { + return this.camp() + .activities() + .items.filter( + (activity) => activity.category()._meta.self === category._meta.self + ) + }, + goToActivityAdmin() { + this.$router.push({ name: 'admin/activity', params: { campId: this.camp().id } }) + }, + }, } From 29b074261ab2f8426178fe6aa1563469627fdefb Mon Sep 17 00:00:00 2001 From: Manuel Meister Date: Sun, 31 Dec 2023 16:19:22 +0100 Subject: [PATCH 11/18] Fix wording of delete/remove --- frontend/src/locales/de.json | 1 + frontend/src/locales/en.json | 1 + frontend/src/locales/fr.json | 3 ++- frontend/src/locales/it.json | 3 ++- frontend/src/locales/rm.json | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index a167b1d770..91bd627977 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -431,6 +431,7 @@ "move": "Verschieben", "ok": "OK", "open": "Öffnen", + "remove": "Entfernen", "rename": "Umbenennen", "save": "Speichern", "saving": "Speichert", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 4d2d24e6a0..1535fdc015 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -431,6 +431,7 @@ "move": "Move", "ok": "OK", "open": "Open", + "remove": "Remove", "rename": "Rename", "save": "Save", "saving": "Saving", diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json index 103113163d..7be881edc9 100644 --- a/frontend/src/locales/fr.json +++ b/frontend/src/locales/fr.json @@ -402,7 +402,7 @@ "content": "Contenu", "continue": "Continuer", "create": "Créer", - "delete": "Effacer", + "delete": "Supprimer", "discard": "Rejeter", "download": "Télécharger", "edit": "Éditer", @@ -414,6 +414,7 @@ "move": "Déplacer", "ok": "OK", "open": "Ouvrir", + "remove": "Retirer", "rename": "Renommer", "save": "Sauvegarder", "saving": "En cours de sauvegarde", diff --git a/frontend/src/locales/it.json b/frontend/src/locales/it.json index 094877e5da..074f924ef7 100644 --- a/frontend/src/locales/it.json +++ b/frontend/src/locales/it.json @@ -402,7 +402,7 @@ "content": "Contenuto", "continue": "Continuare", "create": "Creare", - "delete": "Cancellare", + "delete": "Eliminare", "discard": "Scartare", "download": "Scaricare", "edit": "Modificare", @@ -414,6 +414,7 @@ "move": "Spostamento", "ok": "Bene", "open": "Aprire", + "remove": "Rimuovere", "rename": "Rinominare", "save": "Salvare", "saving": "Salvataggio", diff --git a/frontend/src/locales/rm.json b/frontend/src/locales/rm.json index d42d9a84ee..dde90220aa 100644 --- a/frontend/src/locales/rm.json +++ b/frontend/src/locales/rm.json @@ -378,6 +378,7 @@ "move": "Spustar", "ok": "OK", "open": "Avrir", + "remove": "Allontanar", "rename": "Renumnar", "save": "Memorisar", "saving": "Memorisà", From 6f044d30ef49e7719ce76423953a7c0c0aedaaa2 Mon Sep 17 00:00:00 2001 From: Manuel Meister Date: Sun, 31 Dec 2023 16:28:54 +0100 Subject: [PATCH 12/18] Simplify category editing --- .../campAdmin/DialogCategoryCreate.vue | 2 +- .../category/CategoryProperties.vue | 60 +++++++ .../components/category/CategoryTemplate.vue | 165 ++++++++++++++++++ frontend/src/locales/de.json | 13 ++ frontend/src/locales/en.json | 13 ++ frontend/src/locales/fr.json | 13 ++ frontend/src/locales/it.json | 13 ++ frontend/src/locales/rm.json | 13 ++ frontend/src/views/category/Category.vue | 79 +++++---- 9 files changed, 330 insertions(+), 41 deletions(-) create mode 100644 frontend/src/components/category/CategoryProperties.vue create mode 100644 frontend/src/components/category/CategoryTemplate.vue diff --git a/frontend/src/components/campAdmin/DialogCategoryCreate.vue b/frontend/src/components/campAdmin/DialogCategoryCreate.vue index ede82ba841..e8275f9ccc 100644 --- a/frontend/src/components/campAdmin/DialogCategoryCreate.vue +++ b/frontend/src/components/campAdmin/DialogCategoryCreate.vue @@ -61,7 +61,7 @@ export default { async createCategory() { const createdCategory = await this.create() await this.api.reload(this.camp.categories()) - this.$router.push(categoryRoute(this.camp, createdCategory)) + this.$router.push(categoryRoute(this.camp, createdCategory, { new: true })) }, }, } diff --git a/frontend/src/components/category/CategoryProperties.vue b/frontend/src/components/category/CategoryProperties.vue new file mode 100644 index 0000000000..7c8830076a --- /dev/null +++ b/frontend/src/components/category/CategoryProperties.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/frontend/src/components/category/CategoryTemplate.vue b/frontend/src/components/category/CategoryTemplate.vue new file mode 100644 index 0000000000..daabdb8b51 --- /dev/null +++ b/frontend/src/components/category/CategoryTemplate.vue @@ -0,0 +1,165 @@ + + + + + diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 91bd627977..9895c5295c 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -170,6 +170,14 @@ "submitTooltipPrototype": "Du must noch auswählen ob und welche Lagervorlage du verwenden möchtest." } }, + "category": { + "categoryTemplate": { + "contents": "Inhalte", + "createLayoutHelp": "Hier kannst du die Vorlage für neue {categoryShort}-Blöcke definieren.{br}Blockinhalt & Layout bereits erstellter {categoryShort}-Blöcke, werden nicht angepasst.", + "layout": "Layout", + "noTemplate": "Keine Vorlage" + } + }, "collaborator": { "collaboratorCreate": { "invite": "Einladung verschicken", @@ -655,6 +663,11 @@ "category": { "category": { "deleteCategory": "Kategorie löschen", + "properties": "Eigenschaften", + "template": "Vorlage für neue Blöcke" + }, + "sideBarCategory": { + "title": "Kategorien" } }, "material": { diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 1535fdc015..cfdf800849 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -170,6 +170,14 @@ "submitTooltipPrototype": "You need to choose if and which template you want." } }, + "category": { + "categoryTemplate": { + "contents": "Contents", + "createLayoutHelp": "Here you can define the template for new {categoryShort} activities.{br}The content & layout of already created {categoryShort} activities will not be adjusted.", + "layout": "Layout", + "noTemplate": "No template" + } + }, "collaborator": { "collaboratorCreate": { "invite": "Send invitation", @@ -655,6 +663,11 @@ "category": { "category": { "deleteCategory": "Delete category", + "properties": "Properties", + "template": "Template for new activities" + }, + "sideBarCategory": { + "title": "Categories" } }, "material": { diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json index 7be881edc9..c0392f79f0 100644 --- a/frontend/src/locales/fr.json +++ b/frontend/src/locales/fr.json @@ -162,6 +162,14 @@ "submitTooltipPrototype": "Tu dois encore choisir si tu veux utiliser un modèle de champ et lequel." } }, + "category": { + "categoryTemplate": { + "contents": "Contenus", + "createLayoutHelp": "Ici, vous pouvez définir le modèle pour de nouvelles activités {categoryShort}.{br}Le contenu et la mise en page des activités {categoryShort} déjà créées ne seront pas ajustés.", + "layout": "Layout", + "noTemplate": "Pas de modèle" + } + }, "collaborator": { "collaboratorCreate": { "invite": "Envoyer l'invitation", @@ -635,6 +643,11 @@ "category": { "category": { "deleteCategory": "Supprimer l'activité", + "properties": "Propriétés", + "template": "Modèle pour nouvelles activités" + }, + "sideBarCategory": { + "title": "Catégories" } }, "material": { diff --git a/frontend/src/locales/it.json b/frontend/src/locales/it.json index 074f924ef7..a6fac6e83f 100644 --- a/frontend/src/locales/it.json +++ b/frontend/src/locales/it.json @@ -162,6 +162,14 @@ "submitTooltipPrototype": "È ancora necessario selezionare se e quale modello di campo si desidera utilizzare." } }, + "category": { + "categoryTemplate": { + "contents": "Contenuti", + "createLayoutHelp": "Qui puoi definire il modello per le nuove attività {categoryShort}.{br}Il contenuto e il layout delle attività {categoryShort} già create non verranno modificati.", + "layout": "Layout", + "noTemplate": "Nessun modello" + } + }, "collaborator": { "collaboratorCreate": { "invite": "Inviare l'invito", @@ -635,6 +643,11 @@ "category": { "category": { "deleteCategory": "Elimina la categoria", + "properties": "Proprietà", + "template": "Modello per le nuove attività" + }, + "sideBarCategory": { + "title": "Categorie" } }, "material": { diff --git a/frontend/src/locales/rm.json b/frontend/src/locales/rm.json index dde90220aa..7735e293d7 100644 --- a/frontend/src/locales/rm.json +++ b/frontend/src/locales/rm.json @@ -127,6 +127,14 @@ "description": "I na po betg vegnir extendì. Las suandantas activitads vegnan anc utilisadas:" } }, + "category": { + "categoryTemplate": { + "contents": "Cuntegns", + "createLayoutHelp": "Qua pudais vus definir il project per novas activitads da {categoryShort}.{br}Il cuntegn ed il layout ch'èn gia vegnidas fatgas da {categoryShort} na vegnan betg adattads.", + "layout": "Layout", + "noTemplate": "Nagin model" + } + }, "collaborator": { "collaboratorCreate": { "invite": "Trametter l'invitaziun", @@ -605,6 +613,11 @@ "category": { "category": { "deleteCategory": "Stizzar la categoria", + "properties": "Proprietad", + "template": "Model per novas activitads" + }, + "sideBarCategory": { + "title": "Categorias" } }, "material": { diff --git a/frontend/src/views/category/Category.vue b/frontend/src/views/category/Category.vue index a6c05b82cf..1a5148dbde 100644 --- a/frontend/src/views/category/Category.vue +++ b/frontend/src/views/category/Category.vue @@ -9,20 +9,6 @@ - - From 86a80113b9ff0883c4fcddccf07b0859408e82b0 Mon Sep 17 00:00:00 2001 From: Manuel Meister Date: Mon, 1 Jan 2024 19:20:48 +0100 Subject: [PATCH 13/18] Fix missing readonly prop rename to disabled --- frontend/src/views/category/Category.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/category/Category.vue b/frontend/src/views/category/Category.vue index 1a5148dbde..2a4360f1e6 100644 --- a/frontend/src/views/category/Category.vue +++ b/frontend/src/views/category/Category.vue @@ -65,7 +65,7 @@ :category="category()" :layout-mode="layoutMode" :loading="loading" - :readonly="!isManager" + :disabled="!isManager" /> From 90d9e25017d688f4f6fc8c0c2ff280c92c8d8746 Mon Sep 17 00:00:00 2001 From: Manuel Meister Date: Mon, 1 Jan 2024 19:35:40 +0100 Subject: [PATCH 14/18] Add loading skeleton --- .../src/components/campAdmin/CampActivityProgressLabels.vue | 5 +++++ frontend/src/components/campAdmin/CampCategories.vue | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/campAdmin/CampActivityProgressLabels.vue b/frontend/src/components/campAdmin/CampActivityProgressLabels.vue index 68e0e4643c..d37712b892 100644 --- a/frontend/src/components/campAdmin/CampActivityProgressLabels.vue +++ b/frontend/src/components/campAdmin/CampActivityProgressLabels.vue @@ -18,6 +18,11 @@ +