mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
289 - Confirm Delete Dialogs (#298)
* Added confirm dialogs to delete * Localization fix
This commit is contained in:
parent
5aa9ba661a
commit
61f04df765
7 changed files with 101 additions and 10 deletions
|
|
@ -218,7 +218,6 @@ export default function DHApplicationMixin(Base) {
|
|||
*/
|
||||
static async #createDoc(event, button) {
|
||||
const { documentClass, type } = button.dataset;
|
||||
console.log(documentClass, type);
|
||||
const parent = this.document;
|
||||
|
||||
const cls = getDocumentClass(documentClass);
|
||||
|
|
@ -250,7 +249,23 @@ export default function DHApplicationMixin(Base) {
|
|||
*/
|
||||
static async #deleteDoc(_event, button) {
|
||||
const { type, docId } = button.dataset;
|
||||
await this.document.getEmbeddedDocument(type, docId, { strict: true }).delete();
|
||||
const document = this.document.getEmbeddedDocument(type, docId, { strict: true });
|
||||
const typeName = game.i18n.localize(
|
||||
document.type === 'base' ? `DOCUMENT.${type}` : `TYPES.${type}.${document.type}`
|
||||
);
|
||||
|
||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||
window: {
|
||||
title: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.title', {
|
||||
type: typeName,
|
||||
name: document.name
|
||||
})
|
||||
},
|
||||
content: game.i18n.format('DAGGERHEART.APPLICATIONS.DeleteConfirmation.text', { name: document.name })
|
||||
});
|
||||
if (!confirmed) return;
|
||||
|
||||
await document.delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue