1
0
Fork 0
mirror of https://github.com/em-squared/5e-drs.git synced 2025-10-30 21:24:18 +00:00
5e-drs/docs/.vuepress/theme/layouts/SpellLayout.vue

67 lines
1.7 KiB
Vue
Raw Normal View History

2020-03-26 19:04:23 +01:00
<template>
<div class="spell">
<div class="d-flex align-center mb-4 d-print-none">
<Breadcrumb class="mr-auto" />
<v-btn color="primary" class="mr-4" depressed link to="/creation-de-sort/"><v-icon left>mdi-plus</v-icon> Créer un sort</v-btn>
<v-btn :outlined="!isSpellInSpellBook" color="accent" class="mr-4" depressed @click="toggleSpellInSpellBook"><v-icon>mdi-book</v-icon> {{ displayToggleSpellButton }}</v-btn>
<v-btn color="primary" class="mr-4" depressed link to="/mon-grimoire/">Mon Grimoire</v-btn>
</div>
<Spell :spell="$page" />
2020-04-15 16:27:16 +02:00
<Edit />
2020-03-26 19:04:23 +01:00
</div>
</template>
<script>
2020-04-05 14:38:20 +02:00
import Breadcrumb from '@theme/components/Breadcrumb'
import Spell from '@theme/components/Spell'
2020-04-15 16:27:16 +02:00
import Edit from '@theme/components/Edit'
2020-03-26 19:04:23 +01:00
export default {
name: 'SpellLayout',
components: {
2020-04-05 14:38:20 +02:00
Breadcrumb,
2020-04-15 16:27:16 +02:00
Spell,
Edit
2020-04-02 14:20:33 +02:00
},
computed: {
isSpellInSpellBook () {
let isInSpellBook = false
for (let s of this.$store.state.mySpells.spells) {
if (s.key == this.$page.key) {
isInSpellBook = true
}
}
return isInSpellBook
},
displayToggleSpellButton () {
if (this.isSpellInSpellBook) {
return 'Supprimer de mon grimoire'
}
return 'Ajouter à mon grimoire'
}
},
methods: {
toggleSpellInSpellBook () {
if (this.isSpellInSpellBook) {
this.$store.commit('mySpells/removeSpell', this.$page)
} else {
this.$store.commit('mySpells/addSpell', this.$page)
}
}
},
2020-04-02 14:20:33 +02:00
mounted () {
this.$store.commit('setHasRightDrawer', false)
2020-04-11 18:01:59 +02:00
this.$store.commit('setRightDrawer', this.$vuetify.breakpoint.lgAndUp)
2020-04-02 14:20:33 +02:00
this.$store.commit('setInRightDrawer', null)
2020-03-26 19:04:23 +01:00
}
}
</script>
<style>
</style>