From 3b74521e4040d1a8bebbde959a4c995bd7540c7f Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Fri, 21 Apr 2017 11:07:13 +0200 Subject: [PATCH] Update to single file per mensa/day --- src/App.vue | 1 + src/components/Mensa.vue | 1 - src/components/Tag.vue | 6 ++++++ src/lib/Mensen.js | 22 ++++++++++++++++++++++ src/router/index.js | 1 + 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/lib/Mensen.js diff --git a/src/App.vue b/src/App.vue index 7f7001a..bb6a0e3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,6 +12,7 @@ export default { name: 'app', data () { return { + menu: {} } } } diff --git a/src/components/Mensa.vue b/src/components/Mensa.vue index f6d874b..d25f90d 100644 --- a/src/components/Mensa.vue +++ b/src/components/Mensa.vue @@ -3,7 +3,6 @@ Heute Morgen Übermorgen -

{{$route.params.mensa}}

diff --git a/src/components/Tag.vue b/src/components/Tag.vue index f13fccf..f14832b 100644 --- a/src/components/Tag.vue +++ b/src/components/Tag.vue @@ -11,7 +11,13 @@ export default { name: 'mensa', data () { return { + meals: [] } + }, + created () { + fetch(`/static/${this.$route.params.mensa}.${this.$route.params.tag}.json`) + .then(res => res.json()) + .then(menu => {this.meals = menu.meals}) } } diff --git a/src/lib/Mensen.js b/src/lib/Mensen.js new file mode 100644 index 0000000..bc48d56 --- /dev/null +++ b/src/lib/Mensen.js @@ -0,0 +1,22 @@ +export default { + nordmensa: { + name: 'Nordmensa', + url: name + }, + zentralmensa: { + name: 'Zentralmensa', + url: name + }, + turmmensa: { + name: 'Mensa am Turm', + url: 'Mensa%20am%20Turm' + }, + mensaItalia: { + name: 'Mensa Italia', + url: 'Mensa%20Italia' + }, + bistroHAWK: { + name: 'Bistro HAWK', + url: 'Bistro%20HAWK' + } +} diff --git a/src/router/index.js b/src/router/index.js index 908bbbc..c1e9ceb 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -18,6 +18,7 @@ export default new Router({ path: '/:mensa', name: 'Mensa', component: Mensa, + props: {name: 'info'}, children: [{ path: ':tag', component: Tag