diff --git a/.gitignore b/.gitignore
index ad58a49..97bd5ea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
static/*mensa*.json
+static/*bistro*.json
diff --git a/src/App.vue b/src/App.vue
index 173bc88..a6ec2ef 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -2,15 +2,22 @@
Essen in Göttingen
-
+ Wo?
+
+ Wann?
@@ -22,7 +29,23 @@ export default {
data () {
return {
menu: {},
- mensen: Mensen
+ mensen: Mensen,
+ days: [1, 2, 3, 4, 5, 6],
+ dayOfWeek: {
+ 1: 'Montag',
+ 2: 'Dienstag',
+ 3: 'Mittwoch',
+ 4: 'Donnerstag',
+ 5: 'Freitag',
+ 6: 'Samstag'
+ },
+ where: 'zentralmensa',
+ when: '' + new Date().getDay()
+ }
+ },
+ methods: {
+ updateRoute () {
+ this.$router.push(`/${this.where}/${this.when}`)
}
},
filters: {
diff --git a/src/components/Mensa.vue b/src/components/Mensa.vue
index 0d8fef9..496afee 100644
--- a/src/components/Mensa.vue
+++ b/src/components/Mensa.vue
@@ -1,9 +1,9 @@
-
-
+
+
{{meal.category}}
+
{{meal.title}}
+
@@ -12,6 +12,7 @@ export default {
name: 'mensa',
data () {
return {
+ meals: [],
days: [1, 2, 3, 4, 5, 6],
dayOfWeek: {
1: 'Montag',
@@ -31,17 +32,33 @@ export default {
if (!this.$route.params.tag) {
this.$router.push('' + new Date().getDay())
}
+ this.loadMeals()
}
},
- mounted () {
- if (!this.$route.fullPath.endsWith('/')) {
- this.$router.replace(this.$route.fullPath + '/')
- }
- if (!this.$route.params.tag) {
- this.$router.push('' + new Date().getDay())
+ methods: {
+ loadMeals () {
+ fetch(`/static/${this.$route.params.mensa}.${this.$route.params.tag}.json`)
+ .then(res => res.json())
+ .then(menu => { this.meals = menu.meals })
}
+ },
+ created () {
+ this.$router.replace(`/zentralmensa/${new Date().getDay()}`)
+ this.loadMeals()
}
}
+
+
diff --git a/src/lib/Mensen.js b/src/lib/Mensen.js
index 3757cc4..ea94fb7 100644
--- a/src/lib/Mensen.js
+++ b/src/lib/Mensen.js
@@ -1,8 +1,4 @@
export default {
- nordmensa: {
- name: 'Nordmensa',
- url: 'nordmensa'
- },
zentralmensa: {
name: 'Zentralmensa',
url: 'zentralmensa'
@@ -11,6 +7,10 @@ export default {
name: 'Mensa am Turm',
url: 'turmmensa'
},
+ nordmensa: {
+ name: 'Nordmensa',
+ url: 'nordmensa'
+ },
mensaItalia: {
name: 'Mensa Italia',
url: 'mensaitalia'
diff --git a/src/router/index.js b/src/router/index.js
index c1e9ceb..8001b16 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,8 +1,6 @@
import Vue from 'vue'
import Router from 'vue-router'
-import Hello from '@/components/Hello'
import Mensa from '@/components/Mensa'
-import Tag from '@/components/Tag'
Vue.use(Router)
@@ -11,18 +9,12 @@ export default new Router({
routes: [
{
path: '/',
- name: 'Hello',
- component: Hello
+ name: 'Mensa',
+ component: Mensa
},
{
- path: '/:mensa',
- name: 'Mensa',
- component: Mensa,
- props: {name: 'info'},
- children: [{
- path: ':tag',
- component: Tag
- }]
+ path: '/:mensa/:tag',
+ component: Mensa
}
]
})