From 7fdff791b479d4615a235379ed04a73f023d5cb0 Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Tue, 25 Apr 2017 20:32:07 +0200 Subject: [PATCH] Use data from main website --- .gitignore | 3 +-- src/App.vue | 29 +++++++++++++++++++++++++---- src/assets/links.css | 15 +++++++++++++++ src/components/Mensa.vue | 32 +++++++++++++++++++++++++++----- src/lib/Mensen.js | 10 +++++----- 5 files changed, 73 insertions(+), 16 deletions(-) create mode 100644 src/assets/links.css diff --git a/.gitignore b/.gitignore index 7c666cd..ad58a49 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,4 @@ dist/ npm-debug.log* yarn-debug.log* yarn-error.log* -static/*heute.json -static/*morgen.json +static/*mensa*.json diff --git a/src/App.vue b/src/App.vue index 5d99911..173bc88 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,9 +3,7 @@

Essen in Göttingen

@@ -18,17 +16,30 @@ + diff --git a/src/assets/links.css b/src/assets/links.css new file mode 100644 index 0000000..2a85c24 --- /dev/null +++ b/src/assets/links.css @@ -0,0 +1,15 @@ +/* mrmrs.io/links */ +a { + transition: color .4s; + color: #265C83; +} + +a:link, +a:visited { color: #265C83; } +a:hover { color: #7FDBFF; } +a:active { + transition: color .3s; + color: #007BE6; +} + +.link { text-decoration: none; } diff --git a/src/components/Mensa.vue b/src/components/Mensa.vue index fb4cf27..0d8fef9 100644 --- a/src/components/Mensa.vue +++ b/src/components/Mensa.vue @@ -1,8 +1,8 @@ @@ -12,11 +12,33 @@ export default { name: 'mensa', data () { return { + days: [1, 2, 3, 4, 5, 6], + dayOfWeek: { + 1: 'Montag', + 2: 'Dienstag', + 3: 'Mittwoch', + 4: 'Donnerstag', + 5: 'Freitag', + 6: 'Samstag' + } } }, - created () { + watch: { + '$route': function () { + if (!this.$route.fullPath.endsWith('/')) { + this.$router.replace(this.$route.fullPath + '/') + } + if (!this.$route.params.tag) { + this.$router.push('' + new Date().getDay()) + } + } + }, + mounted () { + if (!this.$route.fullPath.endsWith('/')) { + this.$router.replace(this.$route.fullPath + '/') + } if (!this.$route.params.tag) { - this.$router.replace(`heute`) + this.$router.push('' + new Date().getDay()) } } } diff --git a/src/lib/Mensen.js b/src/lib/Mensen.js index bc48d56..3757cc4 100644 --- a/src/lib/Mensen.js +++ b/src/lib/Mensen.js @@ -1,22 +1,22 @@ export default { nordmensa: { name: 'Nordmensa', - url: name + url: 'nordmensa' }, zentralmensa: { name: 'Zentralmensa', - url: name + url: 'zentralmensa' }, turmmensa: { name: 'Mensa am Turm', - url: 'Mensa%20am%20Turm' + url: 'turmmensa' }, mensaItalia: { name: 'Mensa Italia', - url: 'Mensa%20Italia' + url: 'mensaitalia' }, bistroHAWK: { name: 'Bistro HAWK', - url: 'Bistro%20HAWK' + url: 'bistrohawk' } }