Frontend for custom radios

This commit is contained in:
Eliot Berriot 2018-01-07 22:13:44 +01:00
parent e7f0c1b88b
commit 07bff17e51
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
9 changed files with 577 additions and 11 deletions

View file

@ -1,13 +1,19 @@
<template>
<div class="ui card">
<div class="content">
<div class="header">Radio : {{ radio.name }}</div>
<div class="header">{{ radio.name }}</div>
<div class="description">
{{ radio.description }}
</div>
</div>
<div class="extra content">
<radio-button class="right floated button" :type="type"></radio-button>
<router-link
class="ui basic yellow button"
v-if="$store.state.auth.authenticated && type === 'custom' && customRadio.user === $store.state.auth.profile.id"
:to="{name: 'library.radios.edit', params: {id: customRadioId }}">
Edit...
</router-link>
<radio-button class="right floated button" :type="type" :custom-radio-id="customRadioId"></radio-button>
</div>
</div>
</template>
@ -17,14 +23,24 @@ import RadioButton from './Button'
export default {
props: {
type: {type: String, required: true}
type: {type: String, required: true},
customRadio: {required: false}
},
components: {
RadioButton
},
computed: {
radio () {
if (this.customRadio) {
return this.customRadio
}
return this.$store.getters['radios/types'][this.type]
},
customRadioId: function () {
if (this.customRadio) {
return this.customRadio.id
}
return null
}
}
}