2020-03-26 19:04:23 +01:00
|
|
|
<template>
|
|
|
|
|
<div class="spell">
|
2020-04-22 14:23:59 +02:00
|
|
|
<div class="d-flex flex-wrap align-center d-print-none">
|
|
|
|
|
<Breadcrumb class="mr-auto b-4" />
|
|
|
|
|
<div class="d-flex flex-wrap align-center">
|
|
|
|
|
<v-btn color="primary" class="mr-4 mb-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 mb-4" depressed @click="toggleSpellInSpellBook"><v-icon>mdi-book</v-icon> {{ displayToggleSpellButton }}</v-btn>
|
2020-05-15 15:48:51 +02:00
|
|
|
<MySpellsButton />
|
2020-04-22 14:23:59 +02:00
|
|
|
</div>
|
2020-04-22 11:17:05 +02:00
|
|
|
</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-05-15 15:48:51 +02:00
|
|
|
import MySpellsButton from '@theme/global-components/MySpellsButton'
|
2020-04-15 16:27:16 +02:00
|
|
|
import Edit from '@theme/components/Edit'
|
2020-05-24 13:32:31 +02:00
|
|
|
import { isResourceInLibrary } from '@theme/util'
|
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,
|
2020-05-15 15:48:51 +02:00
|
|
|
MySpellsButton,
|
2020-04-15 16:27:16 +02:00
|
|
|
Edit
|
2020-04-02 14:20:33 +02:00
|
|
|
},
|
|
|
|
|
|
2020-04-22 11:17:05 +02:00
|
|
|
computed: {
|
|
|
|
|
isSpellInSpellBook () {
|
2020-05-24 13:32:31 +02:00
|
|
|
return isResourceInLibrary(this.$page, this.$store.state.mySpells.spells)
|
2020-04-22 11:17:05 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
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)
|
2020-05-23 11:17:42 +02:00
|
|
|
this.$store.commit('setSnackbarText', "Le sort " + this.$page.title + " a été supprimé de votre grimoire")
|
|
|
|
|
this.$store.commit('setIsOpenSnackbar', true)
|
2020-04-22 11:17:05 +02:00
|
|
|
} else {
|
|
|
|
|
this.$store.commit('mySpells/addSpell', this.$page)
|
2020-05-23 11:17:42 +02:00
|
|
|
this.$store.commit('setSnackbarText', "Le sort " + this.$page.title + " a été ajouté à votre grimoire")
|
|
|
|
|
this.$store.commit('setIsOpenSnackbar', true)
|
2020-04-22 11:17:05 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
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>
|