👌 Fixes all Vue linting issues

This commit is contained in:
Moritz Kröger 2019-03-20 22:39:49 +00:00
parent dfb127be4d
commit 4ee3dcc1d8
18 changed files with 190 additions and 116 deletions

View file

@ -5,11 +5,11 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>EUROMAT 2019</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/favicon.ico"><![endif]-->
<link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png">
<!--[if IE]><link rel="shortcut icon" href="/img/favicon.ico"><![endif]-->
<!-- Add to home screen for Android and modern mobile browsers -->
<link rel="manifest" href="/static/manifest.json">
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#40A6EE">
<!-- Open Graph -->
<meta property="og:url" content="https://www.euromat.info" />
@ -17,16 +17,16 @@
<meta property="og:locale" content="de_DE" />
<meta property="og:locale:alternate" content="en_GB" />
<meta property="og:description" content="Der EUROMAT ist nicht einfach nur ein Wahlomat. Sondern Ihr digitaler Wahl-Freund, der Ihnen einen Eindruck von den europapolitischen Positionen der Parteien vermittelt." />
<meta property="og:image" content="https://www.euromat.info/static/img/facebook.2.png" />
<meta property="og:image:secure_url" content="https://www.euromat.info/static/img/facebook.2.png" />
<meta property="og:image" content="https://www.euromat.info/img/facebook.2.png" />
<meta property="og:image:secure_url" content="https://www.euromat.info/img/facebook.2.png" />
<meta property="fb:app_id" content="766231516835034" />
<!-- Add to home screen for Safari on iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="EUROMAT">
<link rel="apple-touch-icon" href="/static/img/icons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png">
<!-- Add to home screen for Windows -->
<meta name="msapplication-TileImage" content="/static/img/icons/msapplication-icon-144x144.png">
<meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png">
<meta name="msapplication-TileColor" content="#40A6EE">
</head>
<body>

View file

@ -1,7 +1,7 @@
<template>
<section>
<h1>{{ $t('fourzerofour.headline') }}</h1>
<p>{{ $t('fourzerofour.content') }}</p>
<p>{{ $t('fourzerofour.content') }}</p>
<router-link class="btn" :to="{ path: '/' }">
{{ $t('fourzerofour.button') }}
</router-link>

View file

@ -4,7 +4,7 @@
<div class="about-content">
<div class="about-text">
<p v-for="txt of $t('about.content')">
<p v-for="txt of $t('about.content')" :key="txt">
{{ txt }}
</p>
</div>
@ -14,13 +14,22 @@
<div class="group-inner">
<h2>
<a :href="$t('about.teamLabel.polis.url')" target="_blank">
<img class="team-logo polis" :src="polisLogo" width="150" height="100" />
<img
class="team-logo polis"
:src="polisLogo"
width="150"
height="100"
>
<span hidden>{{ $t('about.teamLabel.polis.label') }}</span>
</a>
</h2>
<ul>
<li v-for="(member, index) of $t('about.members.polis')">
<a v-if="member.profile" :href="$t(`about.members.polis[${index}].profile`)" target="_blank">
<li v-for="(member, index) of $t('about.members.polis')" :key="'member-polis-' + index">
<a
v-if="member.profile"
:href="$t(`about.members.polis[${index}].profile`)"
target="_blank"
>
{{ $t(`about.members.polis[${index}].name`) }}
<feather-external-link />
</a>
@ -34,13 +43,22 @@
<div class="group-inner">
<h2>
<a :href="$t('about.teamLabel.poe.url')" target="_blank">
<img class="team-logo poe" :src="poeLogo" width="400" height="60" />
<img
class="team-logo poe"
:src="poeLogo"
width="400"
height="60"
>
<span hidden>{{ $t('about.teamLabel.poe.label') }}</span>
</a>
</h2>
<ul>
<li v-for="(member, index) of $t('about.members.poe')">
<a v-if="member.profile" :href="$t(`about.members.poe[${index}].profile`)" target="_blank">
<li v-for="(member, index) of $t('about.members.poe')" :key="'member-poe-' + index">
<a
v-if="member.profile"
:href="$t(`about.members.poe[${index}].profile`)"
target="_blank"
>
{{ $t(`about.members.poe[${index}].name`) }}
<feather-external-link />
</a>
@ -54,8 +72,12 @@
<div class="group-inner dark">
<h2>{{ $t('about.teamLabel.dev') }}</h2>
<ul>
<li v-for="(member, index) of $t('about.members.dev')">
<a v-if="member.profile" :href="$t(`about.members.dev[${index}].profile`)" target="_blank">
<li v-for="(member, index) of $t('about.members.dev')" :key="'member-dev-' + index">
<a
v-if="member.profile"
:href="$t(`about.members.dev[${index}].profile`)"
target="_blank"
>
{{ $t(`about.members.dev[${index}].name`) }}
<feather-external-link />
</a>

View file

@ -2,14 +2,18 @@
<div id="app">
<header class="app-header">
<router-link :to="{ path: '/' }">
<img class="header-logo" :src="euromatLogo" :width="logoSize" :height="logoSize / 2" />
<img class="header-logo"
:src="euromatLogo"
:width="logoSize"
:height="logoSize / 2"
>
</router-link>
<app-menu :main="topMenu" :languages="languages" />
</header>
<main>
<router-view></router-view>
<router-view />
</main>
<footer>

View file

@ -4,19 +4,23 @@
<div class="emphasis-content">
<p>{{ $t('euromat.emphasis.content') }}</p>
<button type="button" class="btn-dark btn-small" @click="submitEmphasis()">
<button type="button"
class="btn-dark btn-small"
@click="submitEmphasis()"
>
{{ $t('euromat.emphasis.skip') }}
<feather-corner-up-right />
</button>
</div>
<ol class="thesis-list">
<li v-for="thesis of theses">
<li v-for="thesis of theses" :key="thesis.id">
<input
:name="`thesis-${thesis.id}`"
:id="`thesis-${thesis.id}`"
:name="`thesis-${thesis.id}`"
type="checkbox"
@click.self="addThesisEmphasis(thesis, $event)"/>
@click.self="addThesisEmphasis(thesis, $event)"
>
<label :for="`thesis-${thesis.id}`">
<span>{{ getThesisCategory(thesis.category) }}</span>
{{ getThesisTitle(thesis.thesis) }}
@ -51,6 +55,16 @@
}
},
created () {
if (this.$browser.supports('sessionStorage')) {
if (!sessionStorage.getItem('euromat-answers')) {
this.$router.push({ path: this.isGermanLocale ? '/thesen' : '/theses' })
}
} else if (this.$root.$data.backupStorage.answers === undefined) {
this.$router.push({ path: this.isGermanLocale ? '/thesen' : '/theses' })
}
},
methods: {
getThesisCategory (category) {
return category[this.$i18n.locale]
@ -80,16 +94,6 @@
: '/theses/results'
})
}
},
created () {
if (this.$browser.supports('sessionStorage')) {
if (!sessionStorage.getItem('euromat-answers')) {
this.$router.push({ path: this.isGermanLocale ? '/thesen' : '/theses' })
}
} else if (this.$root.$data.backupStorage.answers === undefined) {
this.$router.push({ path: this.isGermanLocale ? '/thesen' : '/theses' })
}
}
}
</script>

View file

@ -6,10 +6,11 @@
<span>/{{ thesesCount }}</span>
</div>
<button
:disabled="this.currentThesis === 0"
:disabled="currentThesis === 0"
class="btn-dark btn-small"
type="button"
@click="goBack">
@click="goBack"
>
{{ $t('euromat.euromat.back') }}
</button>
</div>
@ -22,7 +23,7 @@
<div class="euromat-controls">
<ul class="euromat-btns">
<li v-for="option in options" v-if="option.position !== 'skipped'">
<li v-for="option in options" :key="option.label">
<button type="button" @click="submitAnswer(option, $event)">
{{ option.label }} <feather-icon :type="option.icon" />
</button>
@ -32,7 +33,8 @@
<button
class="btn-dark btn-small"
type="button"
@click="submitAnswer(optionSkip)">
@click="submitAnswer(optionSkip)"
>
{{ optionSkip.label }} <feather-corner-up-right />
</button>
</div>
@ -43,15 +45,10 @@
<script>
import { options, theses } from '@/data'
import Progress from '@/components/progress'
export default {
name: 'EuroMat',
components: {
'thesis-progress': Progress
},
data () {
return {
currentThesis: 0,
@ -85,6 +82,7 @@
label: this.$t(`euromat.options.${option.position}`),
icon: this.getIconName(option.position)
}))
.filter(option => option.position !== 'skipped')
},
optionSkip () {
return this.options[this.options.length - 1]
@ -98,7 +96,7 @@
case 'neutral': return 'circle'
case 'negative': return 'thumbs-down'
case 'skipped': return 'corner-up-right'
default: return
default:
}
},
getThesis (id) {

View file

@ -1,5 +1,5 @@
<template>
<router-view></router-view>
<router-view />
</template>
<script>

View file

@ -10,11 +10,15 @@
</div>
<ul class="party-results">
<li v-for="party of parties">
<li v-for="party of parties" :key="party.token">
<router-link :to="{ path: getPartyPath(party.token.toLowerCase()) }">
<div class="result-party-info">
<div class="result-party-logo">
<img :src="getPartyLogo(party.token)" width="50" height="50" :alt="party.token" />
<img :src="getPartyLogo(party.token)"
width="50"
height="50"
:alt="party.token"
>
</div>
<h2>{{ getScorePercentage(party.score) }}%</h2>
@ -25,20 +29,25 @@
<party-percentage
class="result-percentage"
:value="party.score"
:max="totalScoredPoints" />
:max="totalScoredPoints"
/>
</router-link>
</li>
</ul>
<div class="results-ctrls">
<p>{{ $t('euromat.results.thanks') }}</p>
<router-link tag="a" class="btn" :to="{ path: '/' }">
<router-link tag="a"
class="btn"
:to="{ path: '/' }"
>
{{ $t('euromat.results.buttons.index') }}
</router-link>
<router-link
tag="a"
class="btn btn-dark btn-small"
:to="{ path: this.isGermanLocale ? '/thesen' : '/theses' }">
:to="{ path: isGermanLocale ? '/thesen' : '/theses' }"
>
{{ $t('euromat.results.buttons.startover') }}
<feather-rotate-cw />
</router-link>
@ -83,6 +92,36 @@
}
},
created () {
let emphasized
let answers
if (this.$browser.supports('sessionStorage')) {
emphasized = JSON.parse(sessionStorage.getItem('euromat-emphasized'))
answers = JSON.parse(sessionStorage.getItem('euromat-answers'))
} else {
emphasized = JSON.parse(this.$root.$data.backupStorage.emphasized)
answers = JSON.parse(this.$root.$data.backupStorage.answers)
}
if (!emphasized) {
this.$router.push({ path: this.isGermanLocale ? '/thesen' : '/theses' })
}
this.emphasized = emphasized
this.answers = answers
this.scoringGrid = getScoringGrid(this.answers, this.emphasized)
this.scores = this.getScorePoints(this.scoringGrid)
this.parties = this.parties
.map(this.getScorePerParty)
.sort((a, b) => a.score - b.score)
.reverse()
this.totalScoredPoints = this.scores
.map(s => s.highestScore)
.reduce(addUp, 0)
},
methods: {
getPartyPath (token) {
return this.isGermanLocale
@ -152,36 +191,6 @@
.reduce(addUp, 0)
}
}
},
created () {
let emphasized
let answers
if (this.$browser.supports('sessionStorage')) {
emphasized = JSON.parse(sessionStorage.getItem('euromat-emphasized'))
answers = JSON.parse(sessionStorage.getItem('euromat-answers'))
} else {
emphasized = JSON.parse(this.$root.$data.backupStorage.emphasized)
answers = JSON.parse(this.$root.$data.backupStorage.answers)
}
if (!emphasized) {
this.$router.push({ path: this.isGermanLocale ? '/thesen' : '/theses' })
}
this.emphasized = emphasized
this.answers = answers
this.scoringGrid = getScoringGrid(this.answers, this.emphasized)
this.scores = this.getScorePoints(this.scoringGrid)
this.parties = this.parties
.map(this.getScorePerParty)
.sort((a, b) => a.score - b.score)
.reverse()
this.totalScoredPoints = this.scores
.map(s => s.highestScore)
.reduce(addUp, 0)
}
}
</script>

View file

@ -2,9 +2,9 @@
<section>
<h1>{{ $t('faq.headline') }}</h1>
<ul>
<li v-for="question of $t('faq.questions')">
<li v-for="question of $t('faq.questions')" :key="question.title + question.answer">
<h2>{{ question.title }}</h2>
<p v-for="answer of question.answer">
<p v-for="answer of question.answer" :key="answer">
{{ answer }}
</p>
</li>

View file

@ -2,10 +2,15 @@
<section>
<h1>{{ $t('glossary.headline') }}</h1>
<ul>
<li v-for="(item, index) in terminology">
<h2 :id="item.id">{{ getTermLabel(index) }} <feather-link /></h2>
<li v-for="(item, index) in terminology" :key="item.id">
<h2 :id="item.id">
{{ getTermLabel(index) }} <feather-link />
</h2>
<p>{{ getTermExplanation(index) }}</p>
<a class="btn btn-dark btn-small" :href="getTermReference(index)" target="_blank">
<a class="btn btn-dark btn-small"
:href="getTermReference(index)"
target="_blank"
>
{{ getTermReference(index) }} <feather-external-link />
</a>
</li>

View file

@ -7,8 +7,8 @@
<div class="imprint-group">
<h3>{{ $t('imprint.address.label') }}</h3>
<address>
<span v-for="txt of $t('imprint.address.poe')">
<span>{{ txt }}</span><br />
<span v-for="txt of $t('imprint.address.poe')" :key="txt">
<span>{{ txt }}</span><br>
</span>
</address>
</div>
@ -34,7 +34,9 @@
<div class="imprint-group">
<h3>{{ $t('imprint.register.poe.label') }}</h3>
<p v-for="txt of $t('imprint.register.poe.text')">{{ txt }}</p>
<p v-for="txt of $t('imprint.register.poe.text')" :key="txt">
{{ txt }}
</p>
</div>
</div>
@ -42,8 +44,8 @@
<div class="imprint-group">
<h3>{{ $t('imprint.address.label') }}</h3>
<address>
<span v-for="txt of $t('imprint.address.polis')">
<span>{{ txt }}</span><br />
<span v-for="txt of $t('imprint.address.polis')" :key="txt">
<span>{{ txt }}</span><br>
</span>
</address>
</div>
@ -69,17 +71,21 @@
<div class="imprint-group">
<h3>{{ $t('imprint.register.polis.label') }}</h3>
<p v-for="txt of $t('imprint.register.polis.text')">{{ txt }}</p>
<p v-for="txt of $t('imprint.register.polis.text')" :key="txt">
{{ txt }}
</p>
</div>
</div>
</div>
<hr />
<hr>
<div class="imprint-responsibility">
<div class="imprint-group">
<h3>{{ $t('imprint.responsible.label') }}</h3>
<p v-for="txt of $t('imprint.responsible.text')">{{ txt }}</p>
<p v-for="txt of $t('imprint.responsible.text')" :key="txt">
{{ txt }}
</p>
</div>
<div class="imprint-group inline">
@ -90,10 +96,10 @@
</div>
</div>
<hr />
<hr>
<ul class="imprint-info">
<li v-for="info of $t('imprint.content')">
<li v-for="info of $t('imprint.content')" :key="info.title">
<h2>{{ info.title }}</h2>
<p>{{ info.text }}</p>
</li>

View file

@ -5,7 +5,9 @@
<p
v-for="(txt, index) of $t('intro.content')"
:class="{ 'small': index === $t('intro.content').length -1 }">
:key="txt + index"
:class="{ 'small': index === $t('intro.content').length -1 }"
>
{{ txt }}
</p>

View file

@ -2,16 +2,26 @@
<section>
<header class="party-header">
<div class="party-header-logo">
<img :src="partyLogo" :width="logoSize" :height="logoSize" :alt="partyName" />
<img :src="partyLogo"
:width="logoSize"
:height="logoSize"
:alt="partyName"
>
</div>
<div class="party-header-info">
<router-link v-if="!!answers" class="btn btn-dark btn-small" :to="{ path: resultsPath }">
<router-link v-if="!!answers"
class="btn btn-dark btn-small"
:to="{ path: resultsPath }"
>
{{ $t('party.back') }}
<feather-corner-up-left />
</router-link>
<h1>{{ partyName }}</h1>
<a class="btn" :href="partyProgramLink" target="_blank">
<a class="btn"
:href="partyProgramLink"
target="_blank"
>
{{ $t('party.partyProgram') }}
<feather-external-link />
</a>
@ -21,7 +31,7 @@
<div class="theses-legend">
<p>{{ $t('party.legend') }}:</p>
<ul>
<li v-for="option in options">
<li v-for="option in options" :key="option.position">
<feather-icon :type="positionToIconName(option.position)" />
<span>{{ $t(`euromat.options.${option.position}`) }}</span>
</li>
@ -32,10 +42,12 @@
<li class="list-header">
<h2>{{ $t('party.table.thesis') }}</h2>
<h2>{{ party.token }}</h2>
<h2 v-if="!!answers">{{ $t('party.table.user') }}</h2>
<h2 v-if="!!answers">
{{ $t('party.table.user') }}
</h2>
</li>
<li v-for="thesis in theses">
<li v-for="thesis in theses" :key="thesis.id">
<div class="thesis-facts">
<div class="list-thesis" @click="toggleStatement(thesis.id)">
<div class="thesis-subline">
@ -62,7 +74,10 @@
</li>
</ul>
<router-link v-if="!!answers" class="btn btn-dark btn-small" :to="{ path: resultsPath }">
<router-link v-if="!!answers"
class="btn btn-dark btn-small"
:to="{ path: resultsPath }"
>
{{ $t('party.back') }}
<feather-corner-up-left />
</router-link>

View file

@ -2,9 +2,11 @@
<section>
<h1>{{ $t('privacy.headline') }}</h1>
<ul>
<li v-for="(topic, index) of $t('privacy.topics')">
<h2 v-if="index !== 0">{{ topic.title }}</h2>
<p v-for="content of topic.content">
<li v-for="(topic, index) of $t('privacy.topics')" :key="topic.title + index">
<h2 v-if="index !== 0">
{{ topic.title }}
</h2>
<p v-for="content of topic.content" :key="content">
{{ content }}
</p>
</li>

View file

@ -1,16 +1,18 @@
<template>
<div class="footer">
<ul class="footer-social">
<li v-for="item of social"
<li v-for="(item, index) of social"
:key="index"
:data-message="item.label === 'clipboard' ? item.message : ''"
:class="{ 'show-info': item.label === 'clipboard' && showClipboardInfo }">
<button class="btn-dark" @click="share(item)" >
:class="{ 'show-info': item.label === 'clipboard' && showClipboardInfo }"
>
<button class="btn-dark" @click="share(item)">
<feather-icon :type="item.icon" />
</button>
</li>
</ul>
<ul class="footer-menu">
<li v-for="item of menu">
<li v-for="item of menu" :key="item.route">
<router-link tag="a" :to="item.route">
{{ item.label }}
</router-link>

View file

@ -1,7 +1,7 @@
<template>
<div class="app-menu">
<ul class="top-menu">
<li v-for="item of main">
<li v-for="item of main" :key="item.route">
<router-link tag="a" :to="item.route">
{{ item.label }}
</router-link>
@ -10,11 +10,17 @@
<div class="menu-language">
<button
class="btn-txt"
v-for="lang of languages"
:key="lang.locale"
class="btn-txt"
type="button"
@click="changeLanguage(lang.locale)">
<img :src="lang.icon" :width="buttonSize" :height="buttonSize" :alt="lang.locale" />
@click="changeLanguage(lang.locale)"
>
<img :src="lang.icon"
:width="buttonSize"
:height="buttonSize"
:alt="lang.locale"
>
</button>
</div>
</div>

View file

@ -13,7 +13,6 @@ Vue.use(VueSVGIcon)
Vue.use(VueFeatherIcon)
Vue.use(storage)
/* eslint-disable no-new */
new Vue({
router,
i18n,

View file

@ -1,4 +1,4 @@
$fontPath: '/static/fonts/';
$fontPath: '/fonts/';
$fontAssistant: 'Assistant', Avenir, Helvetica, Arial, sans-serif;
@font-face {