From c06cd38dc9cc4be4162ed53143d2bb770cd91b6b Mon Sep 17 00:00:00 2001 From: Michael Bauer <michael-bauer@posteo.de> Date: Thu, 10 Oct 2024 17:27:18 +0200 Subject: [PATCH] Implement default value for date-url-parameter --- aleksis/apps/chronos/frontend/index.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/aleksis/apps/chronos/frontend/index.js b/aleksis/apps/chronos/frontend/index.js index 70f4064a..3c5c82d6 100644 --- a/aleksis/apps/chronos/frontend/index.js +++ b/aleksis/apps/chronos/frontend/index.js @@ -1,6 +1,7 @@ import { hasPersonValidator } from "aleksis.core/routeValidators"; import Timetable from "./components/Timetable.vue"; import Substitutions from "./components/Substitutions.vue"; +import { DateTime } from "luxon"; export default { meta: { @@ -61,9 +62,18 @@ export default { }, }, { - path: "substitutions/:date/", + path: "substitutions/", + props: true, component: Substitutions, - name: "chronos.listSubstitutionsForDate", + name: "chronos.listSubstitutionsForDateLanding", + redirect: () => { + return { + name: "chronos.listSubstitutionsForDate", + params: { + date: DateTime.now().toISODate(), + }, + }; + }, meta: { inMenu: true, titleKey: "chronos.substitutions.menu_title", @@ -72,6 +82,18 @@ export default { permission: "chronos.view_substitutions_rule", fullWidth: true, }, + children: [ + { + path: ":date/", + component: Substitutions, + name: "chronos.listSubstitutionsForDate", + meta: { + toolbarTitle: "chronos.substitutions.menu_title", + permission: "chronos.view_substitutions_rule", + fullWidth: true, + }, + }, + ], }, ], }; -- GitLab