From b30a206ca3a89a9e6bbf7f9fd3ba7898e8c910ac Mon Sep 17 00:00:00 2001 From: Hangzhi Yu <hangzhi@protonmail.com> Date: Thu, 26 Jan 2023 03:29:37 +0100 Subject: [PATCH] Add SPA support --- CHANGELOG.rst | 5 ++ aleksis/apps/stoelindeling/frontend/index.js | 67 +++++++++++++++++++ .../stoelindeling/frontend/messages/de.json | 5 ++ .../stoelindeling/frontend/messages/en.json | 5 ++ aleksis/apps/stoelindeling/views.py | 3 + 5 files changed, 85 insertions(+) create mode 100644 aleksis/apps/stoelindeling/frontend/index.js create mode 100644 aleksis/apps/stoelindeling/frontend/messages/de.json create mode 100644 aleksis/apps/stoelindeling/frontend/messages/en.json diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 42d851f..ddb4e4b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,11 @@ and this project adheres to `Semantic Versioning`_. Unreleased ---------- +Added +~~~~~ + +* Support for usage with new AlekSIS SPA. + `1.0.2`_ - 2022-11-04 --------------------- diff --git a/aleksis/apps/stoelindeling/frontend/index.js b/aleksis/apps/stoelindeling/frontend/index.js new file mode 100644 index 0000000..8a86491 --- /dev/null +++ b/aleksis/apps/stoelindeling/frontend/index.js @@ -0,0 +1,67 @@ +export default + { + meta: { + inMenu: true, + titleKey: "stoelindeling.menu_title", + icon: "mdi-view-list-outline", + }, + props: { + byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true, + }, + children: [ + { + path: "seating_plans/", + component: () => import("aleksis.core/components/LegacyBaseTemplate.vue"), + name: "stoelindeling.seatingPlans", + meta: { + inMenu: true, + titleKey: "stoelindeling.menu_title", + icon: "mdi-view-list-outline", + permission: "stoelindeling.view_seatingplans_rule", + }, + props: { + byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true, + }, + }, + { + path: "seating_plans/create/", + component: () => import("aleksis.core/components/LegacyBaseTemplate.vue"), + name: "stoelindeling.createSeatingPlan", + props: { + byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true, + }, + }, + { + path: "seating_plans/:pk/", + component: () => import("aleksis.core/components/LegacyBaseTemplate.vue"), + name: "stoelindeling.seatingPlan", + props: { + byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true, + }, + }, + { + path: "seating_plans/:pk/edit/", + component: () => import("aleksis.core/components/LegacyBaseTemplate.vue"), + name: "stoelindeling.editSeatingPlan", + props: { + byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true, + }, + }, + { + path: "seating_plans/:pk/copy/", + component: () => import("aleksis.core/components/LegacyBaseTemplate.vue"), + name: "stoelindeling.copySeatingPlan", + props: { + byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true, + }, + }, + { + path: "seating_plans/:pk/delete/", + component: () => import("aleksis.core/components/LegacyBaseTemplate.vue"), + name: "stoelindeling.deleteSeatingPlan", + props: { + byTheGreatnessOfTheAlmightyAleksolotlISwearIAmWorthyOfUsingTheLegacyBaseTemplate: true, + }, + }, + ], + } diff --git a/aleksis/apps/stoelindeling/frontend/messages/de.json b/aleksis/apps/stoelindeling/frontend/messages/de.json new file mode 100644 index 0000000..dd69976 --- /dev/null +++ b/aleksis/apps/stoelindeling/frontend/messages/de.json @@ -0,0 +1,5 @@ +{ + "stoelindeling": { + "menu_title": "Sitzpläne" + } +} \ No newline at end of file diff --git a/aleksis/apps/stoelindeling/frontend/messages/en.json b/aleksis/apps/stoelindeling/frontend/messages/en.json new file mode 100644 index 0000000..86fbd03 --- /dev/null +++ b/aleksis/apps/stoelindeling/frontend/messages/en.json @@ -0,0 +1,5 @@ +{ + "stoelindeling": { + "menu_title": "Seating plans" + } +} \ No newline at end of file diff --git a/aleksis/apps/stoelindeling/views.py b/aleksis/apps/stoelindeling/views.py index 3c70278..72ac168 100644 --- a/aleksis/apps/stoelindeling/views.py +++ b/aleksis/apps/stoelindeling/views.py @@ -10,6 +10,7 @@ from django_tables2 import SingleTableView from reversion.views import RevisionMixin from rules.contrib.views import PermissionRequiredMixin +from aleksis.core.decorators import pwa_cache from aleksis.core.mixins import ( AdvancedCreateView, AdvancedDeleteView, @@ -24,6 +25,7 @@ from .tables import SeatingPlanTable from .util.perms import get_allowed_seating_plans +@method_decorator(pwa_cache, name="dispatch") class SeatingPlanListView(PermissionRequiredMixin, SingleTableView): """Table of all seating plans.""" @@ -36,6 +38,7 @@ class SeatingPlanListView(PermissionRequiredMixin, SingleTableView): return get_allowed_seating_plans(self.request.user) +@method_decorator(pwa_cache, name="dispatch") class SeatingPlanDetailView(PermissionRequiredMixin, DetailView): """Detail view for seating plans.""" -- GitLab