Added route aliases and party view

This commit is contained in:
Moritz Kröger 2017-08-15 22:25:25 +02:00
parent f63d74a310
commit 873204f925
18 changed files with 93 additions and 11 deletions

View file

@ -7,7 +7,7 @@
<title>eur-o-mat</title>
<link rel="icon" type="image/png" sizes="32x32" href="/static/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/img/icons/favicon-16x16.png">
<!--[if IE]><link rel="shortcut icon" href="/static/img/icons/favicon.ico"><![endif]-->
<!--[if IE]><link rel="shortcut icon" href="/static/img/favicon.ico"><![endif]-->
<!-- Add to home screen for Android and modern mobile browsers -->
<link rel="manifest" href="/static/manifest.json">
<meta name="theme-color" content="#4DBA87">

View file

@ -3,6 +3,7 @@ import About from './components/index'
export default [
{
path: '/über-uns',
alias: '/about-us',
name: 'about',
component: About
}

View file

@ -20,7 +20,7 @@
import '@/assets/icons/european-stars'
export default {
name: 'Eur-O-Mat',
name: 'App',
components: {
'app-menu': Menu

View file

@ -6,11 +6,14 @@
<ul class="party-results">
<li v-for="party of parties">
<h2>{{ party.token }} ({{ getScorePercentage(party.score) }} %)</h2>
<!-- <svgicon :name="getPartyLogoName(item.token)" width="50" height="50" /> -->
<party-percentage
:value="getScorePercentage(party.score)"
:max="totalScoredPoints" />
<router-link :to="{ path: `/partei/${party.token.toLowerCase()}` }">
<h2>{{ party.token }} ({{ getScorePercentage(party.score) }} %)</h2>
<!-- <svgicon :name="getPartyLogoName(item.token)" width="50" height="50" /> -->
<party-percentage
class="result-percentage"
:value="getScorePercentage(party.score)"
:max="totalScoredPoints" />
</router-link>
</li>
</ul>
</section>
@ -134,6 +137,8 @@
this.totalScoredPoints = this.scores
.map(s => s.highestScore)
.reduce(addUp, 0)
console.log(this.parties)
}
}
</script>
@ -154,5 +159,9 @@
flex-direction: column;
margin-bottom: $base-gap;
}
.result-percentage {
height: 40px;
}
}
</style>

View file

@ -6,6 +6,7 @@ import Results from './components/results'
export default [
{
path: '/thesen',
alias: '/theses',
component: Index,
children: [
{
@ -15,11 +16,13 @@ export default [
},
{
path: 'gewichtung',
alias: 'emphasis',
name: 'emphasis',
component: Emphasis
},
{
path: 'ergebnis',
alias: 'results',
name: 'results',
component: Results
}

View file

@ -3,6 +3,7 @@ import FAQ from './components/index'
export default [
{
path: '/faq',
alias: '/alias',
name: 'faq',
component: FAQ
}

View file

@ -1,7 +1,14 @@
<template>
<section>
<h1>{{ $t('imprint.headline') }}</h1>
<p>{{ $t('imprint.content') }}</p>
<div>
<h2>{{ $t('imprint.address') }}</h2>
</div>
<div>
<h2>{{ $t('imprint.address') }}</h2>
</div>
</section>
</template>

View file

@ -1,14 +1,24 @@
export default {
de: {
social: {
polis: [
{ platform: 'Twitter', url: '' },
{ platform: 'Facebook', url: '' }
],
poe: [
{ platform: 'Twitter', url: '' },
{ platform: 'Facebook', url: '' }
]
},
imprint: {
headline: 'Impressum',
content: 'Muss noch geschrieben werden.'
address: 'Adresse'
}
},
en: {
imprint: {
headline: 'Imprint',
content: 'Imprint to be written.'
address: 'Address'
}
}
}

View file

@ -3,6 +3,7 @@ import Imprint from './components/index'
export default [
{
path: '/impressum',
alias: 'imprint',
name: 'imprint',
component: Imprint
}

View file

@ -0,0 +1,19 @@
<template>
<section>
<router-link :to="{ path: '/thesen/ergebnis' }">
{{ $t('party.back') }}
</router-link>
<h1>Partei {{ $route.params.token }}</h1>
</section>
</template>
<script>
export default {
name: 'Party'
}
</script>
<style lang="scss" scoped>
@import "~styles/layout";
</style>

12
src/app/party/i18n.js Normal file
View file

@ -0,0 +1,12 @@
export default {
de: {
party: {
back: 'Zurück'
}
},
en: {
party: {
back: 'Back'
}
}
}

2
src/app/party/index.js Normal file
View file

@ -0,0 +1,2 @@
export { default as routes } from './routes'
export { default as i18n } from './i18n'

10
src/app/party/routes.js Normal file
View file

@ -0,0 +1,10 @@
import Party from './components/index'
export default [
{
path: '/partei/:token',
alias: '/party/:token',
name: 'party',
component: Party
}
]

View file

@ -3,6 +3,7 @@ import Press from './components/index'
export default [
{
path: '/presse',
alias: 'press',
name: 'press',
component: Press
}

View file

@ -3,7 +3,8 @@ import Privacy from './components/index'
export default [
{
path: '/datenschutz',
name: 'datenschutz',
alias: 'privacy',
name: 'privacy',
component: Privacy
}
]

View file

@ -3,6 +3,7 @@ import VueI18n from 'vue-i18n'
import { i18n as intro } from '@/app/intro'
import { i18n as euromat } from '@/app/euromat'
import { i18n as party } from '@/app/party'
import { i18n as about } from '@/app/about'
import { i18n as fourzerofour } from '@/app/404'
import { i18n as faq } from '@/app/faq'
@ -19,6 +20,7 @@ export default new VueI18n({
de: {
...intro.de,
...euromat.de,
...party.de,
...about.de,
...fourzerofour.de,
...faq.de,
@ -29,6 +31,7 @@ export default new VueI18n({
en: {
...intro.en,
...euromat.en,
...party.en,
...about.en,
...fourzerofour.en,
...faq.en,

View file

@ -3,6 +3,7 @@ import Router from 'vue-router'
import { routes as intro } from '@/app/intro'
import { routes as euromat } from '@/app/euromat'
import { routes as party } from '@/app/party'
import { routes as about } from '@/app/about'
import { routes as faq } from '@/app/faq'
import { routes as press } from '@/app/press'
@ -17,6 +18,7 @@ export default new Router({
routes: [
...intro,
...euromat,
...party,
...about,
...faq,
...press,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 198 B