1
0
Fork 0
mirror of https://github.com/em-squared/5e-drs.git synced 2025-10-29 20:54:19 +00:00

ajout de feedback sur les ajouts/suppressions dans les bibliothèques et consolidation. see #20

This commit is contained in:
Maxime Moraine 2020-05-23 11:17:42 +02:00
parent 183c7fcaa5
commit dfb0967b07
16 changed files with 105 additions and 27 deletions

View file

@ -40,7 +40,7 @@
<v-icon v-else>mdi-printer</v-icon>
</v-btn>
<v-btn class="d-print-none mr-2" small depressed link icon :to="{ path: '/creation-d-objet-magique/', query: { key: item.key } }"><v-icon>mdi-pencil</v-icon></v-btn>
<v-btn color="error" class="d-print-none" small depressed icon @click="$store.commit('myMagicItems/removeMagicItem', item)"><v-icon>mdi-delete</v-icon></v-btn>
<v-btn color="error" class="d-print-none" small depressed icon @click="removeMagicItem(item)"><v-icon>mdi-delete</v-icon></v-btn>
</div>
</template>
@ -53,7 +53,7 @@
<h2 class="d-flex align-center">
<div class="mr-4">{{ magicItem.title }}</div>
<v-btn class="d-print-none mr-2" small depressed link :to="{ path: '/creation-de-sort/', query: { key: magicItem.key } }"><v-icon left>mdi-pencil</v-icon> Modifier</v-btn>
<v-btn color="error" class="d-print-none" small depressed @click="$store.commit('myMagicItems/removeMagicItem', magicItem)"><v-icon left>mdi-delete</v-icon> Supprimer</v-btn>
<v-btn color="error" class="d-print-none" small depressed @click="removeMagicItem(magicItem)"><v-icon left>mdi-delete</v-icon> Supprimer</v-btn>
</h2>
<MagicItem :magicItem="magicItem" :isList="true" :hideTitle="true" />
</div>
@ -117,6 +117,11 @@ export default {
},
onClickRow (row, item) {
item.expand(!item.isExpanded)
},
removeMagicItem (magicItem) {
this.$store.commit('myMagicItems/removeMagicItem', magicItem)
this.$store.commit('setSnackbarText', "L'objet magique " + magicItem.title + " a été supprimé de votre bibliothèque")
this.$store.commit('setIsOpenSnackbar', true)
}
}
}

View file

@ -48,7 +48,7 @@
<v-icon v-else>mdi-printer</v-icon>
</v-btn>
<v-btn class="d-print-none mr-2" small depressed link icon :to="{ path: '/creation-de-monstre-pnj/', query: { key: item.key } }"><v-icon>mdi-pencil</v-icon></v-btn>
<v-btn color="error" class="d-print-none" small depressed icon @click="$store.commit('myMonsters/removeMonster', item)"><v-icon>mdi-delete</v-icon></v-btn>
<v-btn color="error" class="d-print-none" small depressed icon @click="removeMonster(item)"><v-icon>mdi-delete</v-icon></v-btn>
</div>
</template>
@ -61,7 +61,7 @@
<h1 class="d-flex align-center">
<div class="mr-4">{{ monster.title }}</div>
<v-btn class="d-print-none mr-2" small depressed link :to="{ path: '/creation-de-monstre-pnj/', query: { key: monster.key } }"><v-icon left>mdi-pencil</v-icon> Modifier</v-btn>
<v-btn color="error" class="d-print-none" small depressed @click="$store.commit('myMonsters/removeMonster', monster)"><v-icon left>mdi-delete</v-icon> Supprimer</v-btn>
<v-btn color="error" class="d-print-none" small depressed @click="removeMonster(monster)"><v-icon left>mdi-delete</v-icon> Supprimer</v-btn>
</h1>
<Monster :monster="monster" :isList="true" :hideTitle="true" />
</div>
@ -131,6 +131,11 @@ export default {
},
onClickRow (row, item) {
item.expand(!item.isExpanded)
},
removeMonster (monster) {
this.$store.commit('myMonsters/removeMonster', monster)
this.$store.commit('setSnackbarText', "Le monstre " + monster.title + " a été supprimé de votre bestiaire")
this.$store.commit('setIsOpenSnackbar', true)
}
}
}

View file

@ -80,7 +80,7 @@
<v-icon v-else>mdi-printer</v-icon>
</v-btn>
<v-btn class="d-print-none mr-2" small depressed link icon :to="{ path: '/creation-de-sort/', query: { key: item.key } }"><v-icon>mdi-pencil</v-icon></v-btn>
<v-btn color="error" class="d-print-none" small depressed icon @click="$store.commit('mySpells/removeSpell', item)"><v-icon>mdi-delete</v-icon></v-btn>
<v-btn color="error" class="d-print-none" small depressed icon @click="removeSpell(item)"><v-icon>mdi-delete</v-icon></v-btn>
</div>
</template>
@ -96,7 +96,7 @@
<h3 class="d-flex align-center title">
<div class="mr-4">{{ spell.title }}</div>
<v-btn class="d-print-none mr-2" small depressed link :to="{ path: '/creation-de-sort/', query: { key: spell.key } }"><v-icon left>mdi-pencil</v-icon> Modifier</v-btn>
<v-btn color="error" class="d-print-none" small depressed @click="$store.commit('mySpells/removeSpell', spell)"><v-icon left>mdi-delete</v-icon> Supprimer</v-btn>
<v-btn color="error" class="d-print-none" small depressed @click="removeSpell(spell)"><v-icon left>mdi-delete</v-icon> Supprimer</v-btn>
</h3>
<Spell :spell="spell" :isList="true" :hideTitle="true" />
</template>
@ -192,6 +192,11 @@ export default {
},
onClickRow (row, item) {
item.expand(!item.isExpanded)
},
removeSpell (spell) {
this.$store.commit('mySpells/removeSpell', spell)
this.$store.commit('setSnackbarText', "Le sort " + spell.title + " a été supprimé de votre grimoire")
this.$store.commit('setIsOpenSnackbar', true)
}
},
}

View file

@ -144,17 +144,26 @@ export default {
upload (e) {
let file = e.target.files[0]
if (!file) {
return
}
let reader = new FileReader()
let self = this
reader.onload = function() {
let result = JSON.parse(reader.result)
if (result.pid == 'magicItem') {
if (result.pid == 'magicitem') {
self.magicItem = result
self.$store.commit('setSnackbarText', "L'objet magique " + self.magicItem.title + " a été chargé")
self.$store.commit('setIsOpenSnackbar', true)
} else {
self.$store.commit('setSnackbarText', "Le fichier est invalide")
self.$store.commit('setIsOpenSnackbar', true)
}
}
reader.readAsText(file)
this.$refs.uploader.value = ''
},
onUploadClick () {
@ -173,15 +182,19 @@ export default {
toggleMagicItemInTreasureChest () {
if (this.isMagicItemInTreasureChest) {
this.$store.commit('myMagicItems/removeMagicItem', this.magicItem)
this.$store.commit('setSnackbarText', "L'objet magique " + this.magicItem.title + " a été supprimé de votre bibliothèque")
this.$store.commit('setIsOpenSnackbar', true)
} else {
this.$store.commit('myMagicItems/addMagicItem', this.magicItem)
this.$store.commit('setSnackbarText', "L'objet magique " + this.magicItem.title + " a été ajouté à votre bibliothèque")
this.$store.commit('setIsOpenSnackbar', true)
}
},
updateMagicItemInTreasureChest () {
if (this.isMagicItemInTreasureChest) {
this.$store.commit('myMagicItems/updateMagicItem', this.magicItem)
this.$store.commit('setSnackbarText', "L'objet a été mis à jour dans la bibliothèque")
this.$store.commit('setSnackbarText', "L'objet magique a été mis à jour dans votre bibliothèque")
this.$store.commit('setIsOpenSnackbar', true)
}
},

View file

@ -347,6 +347,9 @@ export default {
upload (e) {
let file = e.target.files[0]
if (!file) {
return
}
let reader = new FileReader()
let self = this
@ -354,10 +357,16 @@ export default {
let result = JSON.parse(reader.result)
if (result.pid == 'monster') {
self.monster = result
self.$store.commit('setSnackbarText', "Le monstre " + self.monster.title + " a été chargé")
self.$store.commit('setIsOpenSnackbar', true)
} else {
self.$store.commit('setSnackbarText', "Le fichier est invalide")
self.$store.commit('setIsOpenSnackbar', true)
}
}
reader.readAsText(file)
this.$refs.uploader.value = ''
},
onUploadClick () {
@ -376,8 +385,12 @@ export default {
toggleMonsterInBestiary () {
if (this.isMonsterInBestiary) {
this.$store.commit('myMonsters/removeMonster', this.monster)
this.$store.commit('setSnackbarText', "Le monstre " + this.monster.title + " a été supprimé de votre bestiaire")
this.$store.commit('setIsOpenSnackbar', true)
} else {
this.$store.commit('myMonsters/addMonster', this.monster)
this.$store.commit('setSnackbarText', "Le monstre " + this.monster.title + " a été ajouté à votre bestiaire")
this.$store.commit('setIsOpenSnackbar', true)
}
},

View file

@ -187,6 +187,9 @@ export default {
upload (e) {
let file = e.target.files[0]
if (!file) {
return
}
let reader = new FileReader()
let self = this
@ -194,10 +197,16 @@ export default {
let result = JSON.parse(reader.result)
if (result.pid == 'spell') {
self.spell = result
self.$store.commit('setSnackbarText', "Le sort " + self.spell.title + " a été chargé")
self.$store.commit('setIsOpenSnackbar', true)
} else {
self.$store.commit('setSnackbarText', "Le fichier est invalide")
self.$store.commit('setIsOpenSnackbar', true)
}
}
reader.readAsText(file)
this.$refs.uploader.value = ''
},
onUploadClick () {
@ -216,8 +225,12 @@ export default {
toggleSpellInSpellBook () {
if (this.isSpellInSpellBook) {
this.$store.commit('mySpells/removeSpell', this.spell)
this.$store.commit('setSnackbarText', "Le sort " + this.spell.title + " a été supprimé de votre grimoire")
this.$store.commit('setIsOpenSnackbar', true)
} else {
this.$store.commit('mySpells/addSpell', this.spell)
this.$store.commit('setSnackbarText', "Le sort " + this.spell.title + " a été ajouté à votre grimoire")
this.$store.commit('setIsOpenSnackbar', true)
}
},

View file

@ -41,7 +41,7 @@
<v-snackbar v-model="$store.state.isOpenSnackbar">
{{ $store.state.snackbarText }}
<v-btn color="red" text @click="$store.commit('setIsOpenSnackbar', true)">
<v-btn color="red" text @click="$store.commit('setIsOpenSnackbar', false)">
Fermer
</v-btn>
</v-snackbar>

View file

@ -52,8 +52,12 @@ export default {
toggleMagicItemInTreasureChest () {
if (this.isMagicItemInTreasureChest) {
this.$store.commit('myMagicItems/removeMagicItem', this.$page)
this.$store.commit('setSnackbarText', "L'objet magique " + this.$page.title + " a été supprimé de votre bibliothèque")
this.$store.commit('setIsOpenSnackbar', true)
} else {
this.$store.commit('myMagicItems/addMagicItem', this.$page)
this.$store.commit('setSnackbarText', "L'objet magique " + this.$page.title + " a été ajouté à votre bibliothèque")
this.$store.commit('setIsOpenSnackbar', true)
}
}
},

View file

@ -193,8 +193,12 @@ export default {
toggleItemInTreasureChest (magicItem) {
if (this.isItemInTreasureChest(magicItem)) {
this.$store.commit('myMagicItems/removeMagicItem', magicItem)
this.$store.commit('setSnackbarText', "L'objet magique " + magicItem.title + " a été supprimé de votre bibliothèque")
this.$store.commit('setIsOpenSnackbar', true)
} else {
this.$store.commit('myMagicItems/addMagicItem', magicItem)
this.$store.commit('setSnackbarText', "L'objet magique " + magicItem.title + " a été ajouté à votre bibliothèque")
this.$store.commit('setIsOpenSnackbar', true)
}
},

View file

@ -52,8 +52,12 @@ export default {
toggleMonsterInBestiary () {
if (this.isMonsterInBestiary) {
this.$store.commit('myMonsters/removeMonster', this.$page)
this.$store.commit('setSnackbarText', "Le monstre " + this.$page.title + " a été supprimé de votre bestiaire")
this.$store.commit('setIsOpenSnackbar', true)
} else {
this.$store.commit('myMonsters/addMonster', this.$page)
this.$store.commit('setSnackbarText', "Le monstre " + this.$page.title + " a été ajouté à votre bestiaire")
this.$store.commit('setIsOpenSnackbar', true)
}
}
},

View file

@ -279,8 +279,12 @@ export default {
toggleMonsterInBestiary (monster) {
if (this.isMonsterInBestiary(monster)) {
this.$store.commit('myMonsters/removeMonster', monster)
this.$store.commit('setSnackbarText', "Le monstre " + monster.title + " a été supprimé de votre bestiaire")
this.$store.commit('setIsOpenSnackbar', true)
} else {
this.$store.commit('myMonsters/addMonster', monster)
this.$store.commit('setSnackbarText', "Le monstre " + monster.title + " a été ajouté à votre bestiaire")
this.$store.commit('setIsOpenSnackbar', true)
}
},

View file

@ -103,13 +103,11 @@ export default {
if (result.notPrintedMagicItems) {
self.$store.commit('myMagicItems/setNotPrintedMagicItems', result.notPrintedMagicItems)
}
self.alertText = self.$store.state.myMagicItems.magicItems.length + " objets magiques inscrits dans la bibliothèque."
self.alertType = "success"
self.alertOpen = true
self.$store.commit('setSnackbarText', self.$store.state.myMagicItems.magicItems.length + " objets magiques inscrits dans votre bibliothèque")
self.$store.commit('setIsOpenSnackbar', true)
} else {
self.alertText = "Le fichier est invalide."
self.alertType = "error"
self.alertOpen = true
self.$store.commit('setSnackbarText', "Le fichier est invalide")
self.$store.commit('setIsOpenSnackbar', true)
}
}
@ -133,6 +131,8 @@ export default {
confirmDeletion () {
this.$store.commit('myMagicItems/resetMagicItems')
this.confirmDeleteDialog = false
this.$store.commit('setSnackbarText', "Votre bibliothèque d'objets magiques a été effacée")
this.$store.commit('setIsOpenSnackbar', true)
}
},

View file

@ -102,13 +102,11 @@ export default {
if (result.notPrintedMonsters) {
self.$store.commit('myMonsters/setNotPrintedMonsters', result.notPrintedMonsters)
}
self.alertText = self.$store.state.myMonsters.monsters.length + " monstres inscrits dans le bestiaire."
self.alertType = "success"
self.alertOpen = true
self.$store.commit('setSnackbarText', self.$store.state.myMonsters.monsters.length + " monstres inscrits dans votre bestiaire")
self.$store.commit('setIsOpenSnackbar', true)
} else {
self.alertText = "Le fichier est invalide."
self.alertType = "error"
self.alertOpen = true
self.$store.commit('setSnackbarText', "Le fichier est invalide")
self.$store.commit('setIsOpenSnackbar', true)
}
}
@ -132,6 +130,8 @@ export default {
confirmDeletion () {
this.$store.commit('myMonsters/resetMonsters')
this.confirmDeleteDialog = false
this.$store.commit('setSnackbarText', "Votre bestiaire a été effacé")
this.$store.commit('setIsOpenSnackbar', true)
}
},

View file

@ -107,13 +107,11 @@ export default {
if (result.notPrintedSpells) {
self.$store.commit('mySpells/setNotPrintedSpells', result.notPrintedSpells)
}
self.alertText = self.$store.state.mySpells.spells.length + " sorts inscrits dans le grimoire."
self.alertType = "success"
self.alertOpen = true
self.$store.commit('setSnackbarText', self.$store.state.mySpells.spells.length + " sorts inscrits dans votre grimoire")
self.$store.commit('setIsOpenSnackbar', true)
} else {
self.alertText = "Le fichier est invalide."
self.alertType = "error"
self.alertOpen = true
self.$store.commit('setSnackbarText', "Le fichier est invalide")
self.$store.commit('setIsOpenSnackbar', true)
}
}
@ -137,6 +135,8 @@ export default {
confirmDeletion () {
this.$store.commit('mySpells/resetSpells')
this.confirmDeleteDialog = false
this.$store.commit('setSnackbarText', "Votre grimoire a été effacé")
this.$store.commit('setIsOpenSnackbar', true)
}
},

View file

@ -52,8 +52,12 @@ export default {
toggleSpellInSpellBook () {
if (this.isSpellInSpellBook) {
this.$store.commit('mySpells/removeSpell', this.$page)
this.$store.commit('setSnackbarText', "Le sort " + this.$page.title + " a été supprimé de votre grimoire")
this.$store.commit('setIsOpenSnackbar', true)
} else {
this.$store.commit('mySpells/addSpell', this.$page)
this.$store.commit('setSnackbarText', "Le sort " + this.$page.title + " a été ajouté à votre grimoire")
this.$store.commit('setIsOpenSnackbar', true)
}
}
},

View file

@ -292,8 +292,12 @@ export default {
toggleSpellInSpellBook (spell) {
if (this.isSpellInSpellBook(spell)) {
this.$store.commit('mySpells/removeSpell', spell)
this.$store.commit('setSnackbarText', "Le sort " + spell.title + " a été supprimé de votre grimoire")
this.$store.commit('setIsOpenSnackbar', true)
} else {
this.$store.commit('mySpells/addSpell', spell)
this.$store.commit('setSnackbarText', "Le sort " + spell.title + " a été ajouté à votre grimoire")
this.$store.commit('setIsOpenSnackbar', true)
}
},