Browse Source

Update to single file per mensa/day

vuex
Schneider 8 years ago
parent
commit
3b74521e40
  1. 1
      src/App.vue
  2. 1
      src/components/Mensa.vue
  3. 6
      src/components/Tag.vue
  4. 22
      src/lib/Mensen.js
  5. 1
      src/router/index.js

1
src/App.vue

@ -12,6 +12,7 @@ export default {
name: 'app', name: 'app',
data () { data () {
return { return {
menu: {}
} }
} }
} }

1
src/components/Mensa.vue

@ -3,7 +3,6 @@
<router-link :to="'/' + $route.params.mensa + '/heute'">Heute</router-link> <router-link :to="'/' + $route.params.mensa + '/heute'">Heute</router-link>
<router-link :to="'/' + $route.params.mensa + '/morgen'">Morgen</router-link> <router-link :to="'/' + $route.params.mensa + '/morgen'">Morgen</router-link>
<router-link :to="'/' + $route.params.mensa + '/uebermorgen'">Übermorgen</router-link> <router-link :to="'/' + $route.params.mensa + '/uebermorgen'">Übermorgen</router-link>
<p>{{$route.params.mensa}}</p>
<router-view></router-view> <router-view></router-view>
</div> </div>
</template> </template>

6
src/components/Tag.vue

@ -11,7 +11,13 @@ export default {
name: 'mensa', name: 'mensa',
data () { data () {
return { return {
meals: []
} }
},
created () {
fetch(`/static/${this.$route.params.mensa}.${this.$route.params.tag}.json`)
.then(res => res.json())
.then(menu => {this.meals = menu.meals})
} }
} }
</script> </script>

22
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'
}
}

1
src/router/index.js

@ -18,6 +18,7 @@ export default new Router({
path: '/:mensa', path: '/:mensa',
name: 'Mensa', name: 'Mensa',
component: Mensa, component: Mensa,
props: {name: 'info'},
children: [{ children: [{
path: ':tag', path: ':tag',
component: Tag component: Tag

Loading…
Cancel
Save