added folder deletion confirmation

This commit is contained in:
Bachir Soussi Chiadmi 2021-03-11 19:00:09 +01:00
parent e0f8b123f9
commit df71378e5f
4 changed files with 40 additions and 11 deletions

File diff suppressed because one or more lines are too long

View File

@ -21,7 +21,7 @@ import CoolLightBox from 'vue-cool-lightbox'
Vue.use(CoolLightBox) Vue.use(CoolLightBox)
import VModal from 'vue-js-modal' import VModal from 'vue-js-modal'
Vue.use(VModal) Vue.use(VModal, { dialog: true })
import store from 'vuejs/store' import store from 'vuejs/store'
import router from 'vuejs/route' import router from 'vuejs/route'

View File

@ -170,7 +170,7 @@
</vsa-content> </vsa-content>
</vsa-item> --> </vsa-item> -->
<vsa-item v-if="material.linked_materials"> <vsa-item v-if="material.linked_materials.length">
<vsa-heading> <vsa-heading>
<span class="label">{{ $t("materio.Linked materials") }}</span> <span class="label">{{ $t("materio.Linked materials") }}</span>
</vsa-heading> </vsa-heading>

View File

@ -31,6 +31,7 @@
/> />
</li> </li>
</ul> </ul>
<v-dialog/>
</div> </div>
</template> </template>
@ -88,10 +89,38 @@ export default {
const flagcollid = e.target.getAttribute('flagcollid'); const flagcollid = e.target.getAttribute('flagcollid');
console.log("UserFlags onDeleteFlagColl", flagcollid); console.log("UserFlags onDeleteFlagColl", flagcollid);
this.is_deleting_folder = flagcollid; this.is_deleting_folder = flagcollid;
// TODO: confirm suppression
this.confirmDeleteFlagColl(flagcollid)
},
confirmDeleteFlagColl (flagcollid){
console.log('confirmDeleteFlagCOll', flagcollid, this.flagcolls);
// const index = this.flagcolls.findIndex(i => i.id === flagcollid)
let coll = this.flagcolls[flagcollid]
// console.log("coll to delete", coll);
this.$modal.show('dialog', {
title: "Folder delete",
text: `Please confirm the definitive deletion of ${coll.name} ?`,
buttons: [
{
title: 'Cancel',
default: true,
handler: () => {
this.$modal.hide('dialog')
}
},
{
title: 'Delete',
handler: () => {
console.log('deletion confirmed', flagcollid);
this.deleteFlagColl(flagcollid) this.deleteFlagColl(flagcollid)
.then(() => { .then(() => {
// console.log("onDeleteFlagColl then", data); // console.log("onDeleteFlagColl then", data);
this.is_deleting_folder = false; this.is_deleting_folder = false;
this.$modal.hide('dialog')
})
}
}
]
}) })
}, },
onOpenFlagColl (e) { onOpenFlagColl (e) {