From 5c53e47f6d2d3b211e517c1d5570c037bbb6ec4d Mon Sep 17 00:00:00 2001 From: Avris Date: Sun, 3 Oct 2021 16:56:07 +0200 Subject: [PATCH] #266 [calendar] replace calendarWide with ?layout=basic --- nuxt.config.js | 1 - routes/calendar.vue | 42 +++++++++++++++++++++++++++--------- routes/calendarDay.vue | 32 ++++++++++++++++++++-------- routes/calendarWide.vue | 47 ----------------------------------------- server/calendar.js | 4 ++-- 5 files changed, 57 insertions(+), 69 deletions(-) delete mode 100644 routes/calendarWide.vue diff --git a/nuxt.config.js b/nuxt.config.js index 2d040680..0a8bce7e 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -277,7 +277,6 @@ export default { routes.push({ path: '/' + config.calendar.route, component: resolve(__dirname, 'routes/calendar.vue') }); routes.push({ path: '/' + config.calendar.route + '/:year(\\d\\d\\d\\d)', component: resolve(__dirname, 'routes/calendar.vue') }); routes.push({ path: '/' + config.calendar.route + '/:year(\\d\\d\\d\\d)-:month(\\d\\d)-:day(\\d\\d)', component: resolve(__dirname, 'routes/calendarDay.vue') }); - routes.push({ path: '/calendar-wide', component: resolve(__dirname, 'routes/calendarWide.vue') }); } if (config.api !== null) { diff --git a/routes/calendar.vue b/routes/calendar.vue index 9dcff14b..b6458d06 100644 --- a/routes/calendar.vue +++ b/routes/calendar.vue @@ -1,28 +1,45 @@ @@ -33,12 +50,17 @@ import { Day } from '../src/calendar/helpers'; export default { + layout({route}) { + return route.query.layout === 'basic' ? 'basic' : 'default'; + }, data() { return { year: this.$route.params.year ? calendar.getYear(this.$route.params.year) : calendar.getCurrentYear(), today: Day.today(), + basic: this.$route.query.layout === 'basic', + labels: this.$route.query.labels === 'true', } }, head() { diff --git a/routes/calendarDay.vue b/routes/calendarDay.vue index 1236ce1d..ab5a6e8d 100644 --- a/routes/calendarDay.vue +++ b/routes/calendarDay.vue @@ -1,10 +1,18 @@ @@ -39,6 +49,9 @@ import { Day } from '../src/calendar/helpers'; export default { + layout({route}) { + return route.query.layout === 'basic' ? 'basic' : 'default'; + }, data() { const day = new Day( this.$route.params.year, @@ -49,6 +62,7 @@ return { day, year: calendar.getYear(day.year), + basic: this.$route.query.layout === 'basic', } }, head() { diff --git a/routes/calendarWide.vue b/routes/calendarWide.vue deleted file mode 100644 index c9b0cae8..00000000 --- a/routes/calendarWide.vue +++ /dev/null @@ -1,47 +0,0 @@ - - - diff --git a/server/calendar.js b/server/calendar.js index 2f0459a8..87b37f70 100644 --- a/server/calendar.js +++ b/server/calendar.js @@ -43,7 +43,7 @@ const dumpNameDays = async () => { } (async () => { - await shoot('/calendar-wide', `overview`); - await shoot('/calendar-wide?labels=true', `labels`); + await shoot(`/${config.calendar.route}?layout=basic`, `overview`); + await shoot(`/${config.calendar.route}?layout=basic&labels=true`, `labels`); await dumpNameDays(); })();