Added basic logic for emphasized theses
This commit is contained in:
parent
f76af977c7
commit
aa53890680
|
@ -8,14 +8,18 @@
|
|||
<label :for="`thesis-${thesis.id}`">
|
||||
{{ thesis.thesis }}
|
||||
</label>
|
||||
<input :name="`thesis-${thesis.id}`" :id="`thesis-${thesis.id}`" type="checkbox" />
|
||||
<input
|
||||
:name="`thesis-${thesis.id}`"
|
||||
:id="`thesis-${thesis.id}`"
|
||||
type="checkbox"
|
||||
@click.self="addThesisEmphasis(thesis, $event)"/>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<div class="emphasis-controls">
|
||||
<router-link class="btn" :to="{ path: '/thesen/ergebnis' }">
|
||||
<button type="button" @click="submitEmphasis()">
|
||||
{{ $t('euromat.emphasis.button') }}
|
||||
</router-link>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
@ -28,7 +32,23 @@
|
|||
|
||||
data () {
|
||||
return {
|
||||
theses: getAllTheses()
|
||||
theses: getAllTheses(),
|
||||
emphasized: []
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
addThesisEmphasis (thesis, event) {
|
||||
if (event.target.checked) {
|
||||
this.emphasized.push({ id: thesis.id })
|
||||
} else {
|
||||
const index = this.emphasized.findIndex(item => item.id === thesis.id)
|
||||
this.emphasized.splice(index, 1)
|
||||
}
|
||||
},
|
||||
submitEmphasis () {
|
||||
localStorage.setItem('euromat-emphasized', JSON.stringify(this.emphasized))
|
||||
this.$router.push({ path: '/thesen/ergebnis' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
event && event.target.blur()
|
||||
},
|
||||
forwardToResults () {
|
||||
localStorage.setItem('euromat-results', JSON.stringify(this.answers, null, 2))
|
||||
localStorage.setItem('euromat-results', JSON.stringify(this.answers))
|
||||
this.$router.push({ path: '/thesen/gewichtung' })
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,10 @@
|
|||
},
|
||||
|
||||
mounted () {
|
||||
this.results = JSON.parse(localStorage.getItem('euromat-results'))
|
||||
const results = JSON.parse(localStorage.getItem('euromat-results'))
|
||||
if (results) {
|
||||
this.results = results
|
||||
}
|
||||
console.log(this.results)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,6 +109,8 @@
|
|||
button {
|
||||
padding: 10px;
|
||||
font-size: 25px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in a new issue