add toggleItemSortMode actions
This commit is contained in:
+11
-34
@@ -26,6 +26,7 @@ export default class DeltaGreenActorSheet extends DGSheetMixin(ActorSheetV2) {
|
||||
toggleLethality: DeltaGreenActorSheet._toggleLethality,
|
||||
toggleBondDamage: DeltaGreenActorSheet._toggleBondDamage,
|
||||
clearBondDamage: DeltaGreenActorSheet._clearBondDamage,
|
||||
toggleItemSortMode: DeltaGreenActorSheet._toggleItemSortMode,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -751,6 +752,16 @@ export default class DeltaGreenActorSheet extends DGSheetMixin(ActorSheetV2) {
|
||||
}
|
||||
}
|
||||
|
||||
static _toggleItemSortMode(event, target) {
|
||||
const itemType = target.dataset.gearType;
|
||||
const propString = `${itemType}SortAlphabetical`;
|
||||
const targetProp = `system.settings.sorting.${propString}`;
|
||||
const currentValue = foundry.utils.getProperty(this.actor, targetProp);
|
||||
this.actor.update({
|
||||
[targetProp]: !currentValue,
|
||||
});
|
||||
}
|
||||
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
@@ -781,40 +792,6 @@ export default class DeltaGreenActorSheet extends DGSheetMixin(ActorSheetV2) {
|
||||
li.addEventListener("dragstart", handler, false);
|
||||
});
|
||||
}
|
||||
|
||||
// item sorting toggles
|
||||
html.find(".toggle-item-sorting-style").click((event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const itemType = event.currentTarget.getAttribute("data-gear-type");
|
||||
|
||||
if (itemType === "weapon") {
|
||||
this.actor.update({
|
||||
"system.settings.sorting.weaponSortAlphabetical":
|
||||
!this.actor.system.settings.sorting.weaponSortAlphabetical,
|
||||
});
|
||||
} else if (itemType === "armor") {
|
||||
this.actor.update({
|
||||
"system.settings.sorting.armorSortAlphabetical":
|
||||
!this.actor.system.settings.sorting.armorSortAlphabetical,
|
||||
});
|
||||
} else if (itemType === "gear") {
|
||||
this.actor.update({
|
||||
"system.settings.sorting.gearSortAlphabetical":
|
||||
!this.actor.system.settings.sorting.gearSortAlphabetical,
|
||||
});
|
||||
} else if (itemType === "tome") {
|
||||
this.actor.update({
|
||||
"system.settings.sorting.tomeSortAlphabetical":
|
||||
!this.actor.system.settings.sorting.tomeSortAlphabetical,
|
||||
});
|
||||
} else if (itemType === "ritual") {
|
||||
this.actor.update({
|
||||
"system.settings.sorting.ritualSortAlphabetical":
|
||||
!this.actor.system.settings.sorting.ritualSortAlphabetical,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Resets the actor's current breaking point based on their sanity and POW statistics. */
|
||||
|
||||
@@ -13,11 +13,13 @@
|
||||
<li class="item flexrow item-header">
|
||||
<div class="item-image">
|
||||
{{#if actor.system.settings.sorting.weaponSortAlphabetical }}
|
||||
<a><i class="toggle-item-sorting-style fa-solid fa-solid fa-arrow-down-a-z"
|
||||
data-gear-type="weapon"></i></a>
|
||||
<a data-action="toggleItemSortMode" data-gear-type="weapon">
|
||||
<i class="fa-solid fa-arrow-down-a-z"></i>
|
||||
</a>
|
||||
{{else}}
|
||||
<a><i class="toggle-item-sorting-style fa-solid fa-arrow-down-short-wide"
|
||||
data-gear-type="weapon"></i></a>
|
||||
<a data-action="toggleItemSortMode" data-gear-type="weapon">
|
||||
<i class="fa-solid fa-arrow-down-short-wide"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
@@ -136,14 +138,12 @@
|
||||
|
||||
<div class="item-image">
|
||||
{{#if actor.system.settings.sorting.armorSortAlphabetical }}
|
||||
<a>
|
||||
<i class="toggle-item-sorting-style fa-solid fa-solid fa-arrow-down-a-z"
|
||||
data-gear-type="armor"></i>
|
||||
<a data-action="toggleItemSortMode" data-gear-type="armor">
|
||||
<i class="fa-solid fa-arrow-down-a-z"></i>
|
||||
</a>
|
||||
{{else}}
|
||||
<a>
|
||||
<i class="toggle-item-sorting-style fa-solid fa-arrow-down-short-wide"
|
||||
data-gear-type="armor"></i>
|
||||
<a data-action="toggleItemSortMode" data-gear-type="armor">
|
||||
<i class="fa-solid fa-arrow-down-short-wide"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
@@ -214,11 +214,13 @@
|
||||
<li class="item flexrow item-header">
|
||||
<div class="item-image">
|
||||
{{#if actor.system.settings.sorting.gearSortAlphabetical }}
|
||||
<a><i class="toggle-item-sorting-style fa-solid fa-solid fa-arrow-down-a-z"
|
||||
data-gear-type="gear"></i></a>
|
||||
<a data-action="toggleItemSortMode" data-gear-type="gear">
|
||||
<i class="fa-solid fa-arrow-down-a-z"></i>
|
||||
</a>
|
||||
{{else}}
|
||||
<a><i class="toggle-item-sorting-style fa-solid fa-arrow-down-short-wide"
|
||||
data-gear-type="gear"></i></a>
|
||||
<a data-action="toggleItemSortMode" data-gear-type="gear">
|
||||
<i class="fa-solid fa-arrow-down-short-wide"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
@@ -284,15 +286,13 @@
|
||||
|
||||
<div class="item-image">
|
||||
{{#if actor.system.settings.sorting.tomeSortAlphabetical }}
|
||||
<a>
|
||||
<i class="toggle-item-sorting-style fa-solid fa-solid fa-arrow-down-a-z"
|
||||
data-gear-type="tome">
|
||||
<a data-action="toggleItemSortMode" data-gear-type="tome">
|
||||
<i class="fa-solid fa-arrow-down-a-z">
|
||||
</i>
|
||||
</a>
|
||||
{{else}}
|
||||
<a>
|
||||
<i class="toggle-item-sorting-style fa-solid fa-arrow-down-short-wide"
|
||||
data-gear-type="tome">
|
||||
<a data-action="toggleItemSortMode" data-gear-type="tome">
|
||||
<i class="fa-solid fa-arrow-down-short-wide">
|
||||
</i>
|
||||
</a>
|
||||
{{/if}}
|
||||
@@ -362,9 +362,7 @@
|
||||
data-key="ritual"
|
||||
data-rolltype="skill"
|
||||
title="Ritual activation">
|
||||
<i class="fa-solid fa-dice" data-gear-type="ritual">
|
||||
|
||||
</i>
|
||||
<i class="fa-solid fa-dice"></i>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
@@ -375,14 +373,12 @@
|
||||
|
||||
<div class="item-image">
|
||||
{{#if actor.system.settings.sorting.ritualSortAlphabetical }}
|
||||
<a>
|
||||
<i class="toggle-item-sorting-style fa-solid fa-solid fa-arrow-down-a-z"
|
||||
data-gear-type="ritual"></i>
|
||||
<a data-action="toggleItemSortMode" data-gear-type="ritual">
|
||||
<i class="fa-solid fa-arrow-down-a-z"></i>
|
||||
</a>
|
||||
{{else}}
|
||||
<a>
|
||||
<i class="toggle-item-sorting-style fa-solid fa-arrow-down-short-wide"
|
||||
data-gear-type="ritual"></i>
|
||||
<a data-action="toggleItemSortMode" data-gear-type="ritual">
|
||||
<i class="fa-solid fa-arrow-down-short-wide"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user