Added icon to homebrew menu for DowntimeActions

This commit is contained in:
WBHarry 2025-07-17 18:14:53 +02:00
parent 01ddc4f9e7
commit 545976b5f6
3 changed files with 18 additions and 13 deletions

View file

@ -4,13 +4,14 @@ import DHActionConfig from '../../sheets-configs/action-config.mjs';
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api; const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
export default class DhSettingsActionView extends HandlebarsApplicationMixin(ApplicationV2) { export default class DhSettingsActionView extends HandlebarsApplicationMixin(ApplicationV2) {
constructor(resolve, reject, title, name, img, description, actions) { constructor(resolve, reject, title, name, icon, img, description, actions) {
super({}); super({});
this.resolve = resolve; this.resolve = resolve;
this.reject = reject; this.reject = reject;
this.viewTitle = title; this.viewTitle = title;
this.name = name; this.name = name;
this.icon = icon;
this.img = img; this.img = img;
this.description = description; this.description = description;
this.actions = actions; this.actions = actions;
@ -23,7 +24,7 @@ export default class DhSettingsActionView extends HandlebarsApplicationMixin(App
static DEFAULT_OPTIONS = { static DEFAULT_OPTIONS = {
tag: 'form', tag: 'form',
classes: ['daggerheart', 'setting', 'dh-style'], classes: ['daggerheart', 'setting', 'dh-style'],
position: { width: '400', height: 'auto' }, position: { width: 440, height: 'auto' },
actions: { actions: {
editImage: this.onEditImage, editImage: this.onEditImage,
addItem: this.addItem, addItem: this.addItem,
@ -46,6 +47,7 @@ export default class DhSettingsActionView extends HandlebarsApplicationMixin(App
async _prepareContext(_options) { async _prepareContext(_options) {
const context = await super._prepareContext(_options); const context = await super._prepareContext(_options);
context.name = this.name; context.name = this.name;
context.icon = this.icon;
context.img = this.img; context.img = this.img;
context.description = this.description; context.description = this.description;
context.enrichedDescription = await foundry.applications.ux.TextEditor.enrichHTML(context.description); context.enrichedDescription = await foundry.applications.ux.TextEditor.enrichHTML(context.description);
@ -55,8 +57,9 @@ export default class DhSettingsActionView extends HandlebarsApplicationMixin(App
} }
static async updateData(event, element, formData) { static async updateData(event, element, formData) {
const { name, img, description } = foundry.utils.expandObject(formData.object); const { name, icon, description } = foundry.utils.expandObject(formData.object);
this.name = name; this.name = name;
this.icon = icon;
this.description = description; this.description = description;
this.render(); this.render();
@ -65,6 +68,7 @@ export default class DhSettingsActionView extends HandlebarsApplicationMixin(App
static async saveForm(event) { static async saveForm(event) {
this.resolve({ this.resolve({
name: this.name, name: this.name,
icon: this.icon,
img: this.img, img: this.img,
description: this.description, description: this.description,
actions: this.actions actions: this.actions

View file

@ -76,6 +76,7 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
reject, reject,
game.i18n.localize('DAGGERHEART.SETTINGS.Homebrew.downtimeMoves'), game.i18n.localize('DAGGERHEART.SETTINGS.Homebrew.downtimeMoves'),
move.name, move.name,
move.icon,
move.img, move.img,
move.description, move.description,
move.actions move.actions
@ -87,6 +88,7 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
await this.settings.updateSource({ await this.settings.updateSource({
[`restMoves.${type}.moves.${id}`]: { [`restMoves.${type}.moves.${id}`]: {
name: data.name, name: data.name,
icon: data.icon,
img: data.img, img: data.img,
description: data.description description: data.description
} }

View file

@ -1,18 +1,17 @@
<div> <div>
<div class="form-group">
<label>{{localize "Icon"}}</label>
<div class="form-field">
<input type="text" name="icon" value="{{icon}}" />
</div>
</div>
<fieldset> <fieldset>
<legend>{{localize "Description"}}</legend> <legend>{{localize "Description"}}</legend>
<prose-mirror name="description" value="{{description}}" toggled=true> <prose-mirror name="description" value="{{description}}">
{{{ enrichedDescription }}} {{{ enrichedDescription }}}
</prose-mirror> </prose-mirror>
</fieldset> </fieldset>
{{!-- <fieldset>
<legend>{{localize "Actions"}} <a data-action="addItem"><i class="fa-solid fa-plus"></i></a></legend>
<div class="settings-items">
{{#each this.actions as |action index|}}
{{> "systems/daggerheart/templates/settings/components/settings-item-line.hbs" action type="actions" id=index }}
{{/each}}
</div>
</fieldset> --}}
</div> </div>