Skip to content

Commit

Permalink
#14
Browse files Browse the repository at this point in the history
- #14: Fix Item Properties form not updating on reset, fix Equipment checked on all properties.
  • Loading branch information
Larkinabout committed Feb 18, 2024
1 parent fbd501c commit 2b186b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions scripts/forms/item-properties-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export class ItemPropertiesForm extends CustomDnd5eForm {
constructor (...args) {
super(args)

this.requiresReload = true
this.settingKey = CONSTANTS.ITEM_PROPERTIES.SETTING.KEY
this.setting = getSetting(this.settingKey) || foundry.utils.deepClone(CONFIG.DND5E.itemProperties)
this.setFunction = setItemProperties
Expand All @@ -27,6 +26,8 @@ export class ItemPropertiesForm extends CustomDnd5eForm {
}

async getData () {
this.setting = getSetting(this.settingKey) || foundry.utils.deepClone(CONFIG.DND5E.itemProperties)

return { items: this.setting }
}

Expand Down Expand Up @@ -139,7 +140,7 @@ export class ItemPropertiesForm extends CustomDnd5eForm {
${game.i18n.localize('CUSTOM_DND5E.equipment')}
</label>
<label class="flex1" style="min-width:80px; max-width:100px;">
<input id="feat" name="${data.key}.equipment" type="checkbox">
<input id="feat" name="${data.key}.feat" type="checkbox">
${game.i18n.localize('CUSTOM_DND5E.feat')}
</label>
<label class="flex1" style="min-width:80px; max-width:100px;">
Expand Down Expand Up @@ -198,9 +199,5 @@ export class ItemPropertiesForm extends CustomDnd5eForm {

await setSetting(this.settingKey, this.setting)
this.setFunction(this.setting)

if (this.requiresReload) {
SettingsConfig.reloadConfirm()
}
}
}
}
2 changes: 1 addition & 1 deletion templates/item-properties-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
{{localize "CUSTOM_DND5E.equipment"}}
</label>
<label class="flex1" style="min-width:80px; max-width:100px;">
<input id="feat" name="{{key}}.equipment" type="checkbox"{{#if feat}} checked{{/if}}>
<input id="feat" name="{{key}}.feat" type="checkbox"{{#if feat}} checked{{/if}}>
{{localize "CUSTOM_DND5E.feat"}}
</label>
<label class="flex1" style="min-width:80px; max-width:100px;">
Expand Down

0 comments on commit 2b186b1

Please sign in to comment.