From 9ff3caf8c0a9138b9dc5b2855945849ee73b5cd5 Mon Sep 17 00:00:00 2001 From: sharkykh Date: Thu, 12 Jul 2018 02:30:51 +0300 Subject: [PATCH] Fix schedule page navigating to /not-found (#4602) * Fix schedule page * Fix schedule.mako code style --- themes-default/slim/static/js/router.js | 10 +++++++ themes-default/slim/views/schedule.mako | 36 ++++++++++--------------- themes/dark/assets/js/router.js | 10 +++++++ themes/dark/assets/js/router.js.map | 2 +- themes/dark/templates/schedule.mako | 36 ++++++++++--------------- themes/light/assets/js/router.js | 10 +++++++ themes/light/assets/js/router.js.map | 2 +- themes/light/templates/schedule.mako | 36 ++++++++++--------------- 8 files changed, 74 insertions(+), 68 deletions(-) diff --git a/themes-default/slim/static/js/router.js b/themes-default/slim/static/js/router.js index ddd53241d1..cfef101bdd 100644 --- a/themes-default/slim/static/js/router.js +++ b/themes-default/slim/static/js/router.js @@ -5,6 +5,8 @@ if (!window.router) { const configComponent = httpVueLoader('js/templates/config.vue'); const addShowsComponent = httpVueLoader('js/templates/add-shows.vue'); const addRecommendedComponent = httpVueLoader('js/templates/add-recommended.vue'); + // eslint-disable-next-line capitalized-comments + // const scheduleComponent = httpVueLoader('js/templates/schedule.vue'); const notFoundComponent = httpVueLoader('js/templates/http/404.vue'); const router = new VueRouter({ @@ -34,6 +36,14 @@ if (!window.router) { header: 'Add Recommended Shows' }, component: addRecommendedComponent + }, { + path: '/schedule', + name: 'schedule', + meta: { + title: 'Schedule', + header: 'Schedule' + }, // eslint-disable-line comma-dangle + // component: scheduleComponent }, { path: '/not-found', name: 'not-found', diff --git a/themes-default/slim/views/schedule.mako b/themes-default/slim/views/schedule.mako index db5a23c581..3c5439faa8 100644 --- a/themes-default/slim/views/schedule.mako +++ b/themes-default/slim/views/schedule.mako @@ -13,30 +13,22 @@ const startVue = () => { store, el: '#vue-wrap', router, - metaInfo: { - title: 'Schedule' - }, - data() { - return { - header: 'Schedule' - }; - }, - computed: Object.assign( - store.mapState(['shows']), - { - layout: { - get() { - const { config } = this; - return config.layout.schedule; - }, - set(layout) { - const { $store } = this; - const page = 'schedule'; - $store.dispatch('setLayout', { page, layout }); - } + computed: Object.assign(store.mapState(['shows']), { + header() { + return this.$route.meta.header; + }, + layout: { + get() { + const { config } = this; + return config.layout.schedule; + }, + set(layout) { + const { $store } = this; + const page = 'schedule'; + $store.dispatch('setLayout', { page, layout }); } } - ), + }), mounted() { const { $store, $route } = this; // $store.dispatch('getShows'); diff --git a/themes/dark/assets/js/router.js b/themes/dark/assets/js/router.js index ddd53241d1..cfef101bdd 100644 --- a/themes/dark/assets/js/router.js +++ b/themes/dark/assets/js/router.js @@ -5,6 +5,8 @@ if (!window.router) { const configComponent = httpVueLoader('js/templates/config.vue'); const addShowsComponent = httpVueLoader('js/templates/add-shows.vue'); const addRecommendedComponent = httpVueLoader('js/templates/add-recommended.vue'); + // eslint-disable-next-line capitalized-comments + // const scheduleComponent = httpVueLoader('js/templates/schedule.vue'); const notFoundComponent = httpVueLoader('js/templates/http/404.vue'); const router = new VueRouter({ @@ -34,6 +36,14 @@ if (!window.router) { header: 'Add Recommended Shows' }, component: addRecommendedComponent + }, { + path: '/schedule', + name: 'schedule', + meta: { + title: 'Schedule', + header: 'Schedule' + }, // eslint-disable-line comma-dangle + // component: scheduleComponent }, { path: '/not-found', name: 'not-found', diff --git a/themes/dark/assets/js/router.js.map b/themes/dark/assets/js/router.js.map index f051a178b7..0c37932034 100644 --- a/themes/dark/assets/js/router.js.map +++ b/themes/dark/assets/js/router.js.map @@ -1 +1 @@ -{"version":3,"names":[],"mappings":"","sources":["js/router.js"],"sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i {\n const { meta } = to;\n const { title } = meta;\n\n // If there's no title then it's not a .vue route so skip\n if (title) {\n document.title = `${to.meta.title} | Medusa`;\n }\n\n // Always call next otherwise the will be empty\n next();\n });\n\n window.router = router;\n}\n\n},{}]},{},[1]);\n"],"file":"router.js"} \ No newline at end of file +{"version":3,"names":[],"mappings":"","sources":["js/router.js"],"sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i {\n const { meta } = to;\n const { title } = meta;\n\n // If there's no title then it's not a .vue route so skip\n if (title) {\n document.title = `${to.meta.title} | Medusa`;\n }\n\n // Always call next otherwise the will be empty\n next();\n });\n\n window.router = router;\n}\n\n},{}]},{},[1]);\n"],"file":"router.js"} \ No newline at end of file diff --git a/themes/dark/templates/schedule.mako b/themes/dark/templates/schedule.mako index db5a23c581..3c5439faa8 100644 --- a/themes/dark/templates/schedule.mako +++ b/themes/dark/templates/schedule.mako @@ -13,30 +13,22 @@ const startVue = () => { store, el: '#vue-wrap', router, - metaInfo: { - title: 'Schedule' - }, - data() { - return { - header: 'Schedule' - }; - }, - computed: Object.assign( - store.mapState(['shows']), - { - layout: { - get() { - const { config } = this; - return config.layout.schedule; - }, - set(layout) { - const { $store } = this; - const page = 'schedule'; - $store.dispatch('setLayout', { page, layout }); - } + computed: Object.assign(store.mapState(['shows']), { + header() { + return this.$route.meta.header; + }, + layout: { + get() { + const { config } = this; + return config.layout.schedule; + }, + set(layout) { + const { $store } = this; + const page = 'schedule'; + $store.dispatch('setLayout', { page, layout }); } } - ), + }), mounted() { const { $store, $route } = this; // $store.dispatch('getShows'); diff --git a/themes/light/assets/js/router.js b/themes/light/assets/js/router.js index ddd53241d1..cfef101bdd 100644 --- a/themes/light/assets/js/router.js +++ b/themes/light/assets/js/router.js @@ -5,6 +5,8 @@ if (!window.router) { const configComponent = httpVueLoader('js/templates/config.vue'); const addShowsComponent = httpVueLoader('js/templates/add-shows.vue'); const addRecommendedComponent = httpVueLoader('js/templates/add-recommended.vue'); + // eslint-disable-next-line capitalized-comments + // const scheduleComponent = httpVueLoader('js/templates/schedule.vue'); const notFoundComponent = httpVueLoader('js/templates/http/404.vue'); const router = new VueRouter({ @@ -34,6 +36,14 @@ if (!window.router) { header: 'Add Recommended Shows' }, component: addRecommendedComponent + }, { + path: '/schedule', + name: 'schedule', + meta: { + title: 'Schedule', + header: 'Schedule' + }, // eslint-disable-line comma-dangle + // component: scheduleComponent }, { path: '/not-found', name: 'not-found', diff --git a/themes/light/assets/js/router.js.map b/themes/light/assets/js/router.js.map index f051a178b7..0c37932034 100644 --- a/themes/light/assets/js/router.js.map +++ b/themes/light/assets/js/router.js.map @@ -1 +1 @@ -{"version":3,"names":[],"mappings":"","sources":["js/router.js"],"sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i {\n const { meta } = to;\n const { title } = meta;\n\n // If there's no title then it's not a .vue route so skip\n if (title) {\n document.title = `${to.meta.title} | Medusa`;\n }\n\n // Always call next otherwise the will be empty\n next();\n });\n\n window.router = router;\n}\n\n},{}]},{},[1]);\n"],"file":"router.js"} \ No newline at end of file +{"version":3,"names":[],"mappings":"","sources":["js/router.js"],"sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i {\n const { meta } = to;\n const { title } = meta;\n\n // If there's no title then it's not a .vue route so skip\n if (title) {\n document.title = `${to.meta.title} | Medusa`;\n }\n\n // Always call next otherwise the will be empty\n next();\n });\n\n window.router = router;\n}\n\n},{}]},{},[1]);\n"],"file":"router.js"} \ No newline at end of file diff --git a/themes/light/templates/schedule.mako b/themes/light/templates/schedule.mako index db5a23c581..3c5439faa8 100644 --- a/themes/light/templates/schedule.mako +++ b/themes/light/templates/schedule.mako @@ -13,30 +13,22 @@ const startVue = () => { store, el: '#vue-wrap', router, - metaInfo: { - title: 'Schedule' - }, - data() { - return { - header: 'Schedule' - }; - }, - computed: Object.assign( - store.mapState(['shows']), - { - layout: { - get() { - const { config } = this; - return config.layout.schedule; - }, - set(layout) { - const { $store } = this; - const page = 'schedule'; - $store.dispatch('setLayout', { page, layout }); - } + computed: Object.assign(store.mapState(['shows']), { + header() { + return this.$route.meta.header; + }, + layout: { + get() { + const { config } = this; + return config.layout.schedule; + }, + set(layout) { + const { $store } = this; + const page = 'schedule'; + $store.dispatch('setLayout', { page, layout }); } } - ), + }), mounted() { const { $store, $route } = this; // $store.dispatch('getShows');