Added a real app fo helper/info button (dialog before)

This commit is contained in:
Vlyan
2021-01-05 12:29:13 +01:00
parent 1a292feee2
commit 29b21b7d1c
6 changed files with 95 additions and 67 deletions

View File

@@ -0,0 +1,66 @@
/**
* L5R Help dialog
* @extends {FormApplication}
*/
export class HelpDialog extends FormApplication {
/**
* Payload Object
*/
object = {};
/**
* Assign the default options
* @override
*/
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
id: "l5r5e-help-dialog",
classes: ["l5r5e", "help-dialog"],
template: CONFIG.l5r5e.paths.templates + "help/help-dialog.html",
title: game.i18n.localize("l5r5e.logo.title"),
width: 400,
height: 200,
closeOnSubmit: false,
submitOnClose: false,
submitOnChange: false,
});
}
/**
* Construct and return the data object used to render the HTML template for this form application.
* @param options
* @return {Object}
*/
getData(options = null) {
return {
...super.getData(options),
};
}
/**
* Listen to html elements
* @override
*/
activateListeners(html) {
super.activateListeners(html);
// Buttons
["edge", "drivethrurpg", "discord"].forEach((name) => {
html.find(`button[name='${name}']`).on("click", (event) => {
ui.notifications.info(game.i18n.localize(`l5r5e.logo.${name}-info`));
window.open(game.i18n.localize(`l5r5e.logo.${name}-link`), "_blank");
});
});
}
/**
* This method is called upon form submission after form data is validated
* @param event {Event} The initial triggering submission event
* @param formData {Object} The object of validated form data with which to update the object
* @returns {Promise} A Promise which resolves once the update operation has completed
* @override
*/
_updateObject(event, formData) {
// Nothing, but needed to be override
}
}