diff --git a/src/module/powers/basePowers.js b/src/module/powers/basePowers.js
index 6ab60d4..3aaea2d 100644
--- a/src/module/powers/basePowers.js
+++ b/src/module/powers/basePowers.js
@@ -59,15 +59,22 @@ export class PowerFormApplication extends HandlebarsApplicationMixin(Application
width: 600,
height: 'auto',
},
- classes: ['sheet', 'mbSwadeForm', 'mbSwadePowerEffectsForm'],
+ classes: ['standard-form', 'mbSwade', 'mbSwadeForm', 'mbSwadePowerEffectsForm'],
window: {
icon: 'fa-solid fa-hand-sparkles',
- title: 'mbSwade.powerEffectsForm.title',
+ title: 'Apply Effect',
},
};
static PARTS = {
- body: { template: templates['powerDialog.html'] },
+ header: {
+ template: templates['dialogHeader.html'],
+ classes: ['mbSwade', 'mbSwadeDialogHeader', 'flexrow'],
+ },
+ body: {
+ template: templates['powerDialog.html'],
+ classes: ['mbSwadePowerEffectsBody'],
+ },
footer: {
template: 'templates/generic/form-footer.hbs',
classes: ['sheet-footer', 'flexrow'],
@@ -111,6 +118,8 @@ export class PowerFormApplication extends HandlebarsApplicationMixin(Application
}
const data = {
name: this.powerEffect.name,
+ headerTitle: `${this.powerEffect.name} Effect`,
+ headerSubtitle: `Apply the effects from ${this.powerEffect.name}`,
icon: this.powerEffect.icon,
basePowerPoints: this.powerEffect.basePowerPoints,
modifiers,
@@ -123,6 +132,10 @@ export class PowerFormApplication extends HandlebarsApplicationMixin(Application
targets: [],
buttons: this.powerEffect.menuButtons,
};
+ for (let button of data.buttons) {
+ button.action = button.value;
+ button.type = button.value === 'cancel' ? 'cancel' : 'submit';
+ }
if (this.powerEffect.isTargeted) {
if (this.powerEffect.oneTarget) {
data.targets = [this.powerEffect.targets?.[0]?.name ?? 'No Target Selected!'];
@@ -141,9 +154,10 @@ export class PowerFormApplication extends HandlebarsApplicationMixin(Application
}
static async #onSubmit(event, form, formData) {
- formData.submit = event?.submitter?.value ?? 'cancel';
- if (formData.submit !== 'cancel') {
- this.powerEffect.formData = formData;
+ log(this.formData);
+ formData.object.submit = event?.submitter?.dataset?.action ?? 'cancel';
+ if (formData.object.submit !== 'cancel') {
+ this.powerEffect.formData = formData.object;
this.powerEffect.applyEffect();
}
}
diff --git a/src/module/preloadTemplates.js b/src/module/preloadTemplates.js
index 928de81..9f60aab 100644
--- a/src/module/preloadTemplates.js
+++ b/src/module/preloadTemplates.js
@@ -1,4 +1,4 @@
-const _templatePaths = ['powerDialog.html', 'summonCosts.html'];
+const _templatePaths = ['dialogHeader.html', 'powerDialog.html', 'summonCosts.html'];
export async function preloadTemplates() {
return loadTemplates(_templatePaths.map((f) => `modules/swade-mb-helpers/templates/${f}`));
diff --git a/src/styles/swade-mb-helpers.scss b/src/styles/swade-mb-helpers.scss
index 650bf57..a5f385a 100644
--- a/src/styles/swade-mb-helpers.scss
+++ b/src/styles/swade-mb-helpers.scss
@@ -10,3 +10,23 @@ table.mbForm {
padding-right: 0.25em;
}
}
+
+.mbSwade.mbSwadeDialogHeader {
+ align-items: flex-start;
+
+ img.mbSwadeIcon {
+ margin-right: 1em;
+ }
+
+ .mbSwadeTitle {
+ h2:has(+ p) {
+ margin-bottom: 0;
+ }
+ }
+}
+
+.mbSwade.mbSwadeForm {
+ .mbSwadePowerEffectsBody {
+ margin-bottom: 0.5em;
+ }
+}
diff --git a/src/templates/dialogHeader.html b/src/templates/dialogHeader.html
new file mode 100644
index 0000000..c004167
--- /dev/null
+++ b/src/templates/dialogHeader.html
@@ -0,0 +1,7 @@
+ {{headerSubtitle}}
+
{{headerTitle}}
+ {{#if headerSubtitle}}
Apply the affects of {{name}}.
-