| 
									
										
										
										
											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> | 
					
						
							|  |  |  |         <v-btn color="primary" class="mb-4" depressed link to="/mon-grimoire/">Mon Grimoire</v-btn> | 
					
						
							|  |  |  |       </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-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
										 |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-22 11:17:05 +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> |