mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-22 02:19:54 +02:00
Enable sorting for Loadout domain cards
Add drag-and-drop sorting functionality to Loadout and Vault sections by reusing the exact pattern already implemented for Loot items: - Add `data-item-id` and `draggable="true"` attributes to domain card template (domain-card-item.hbs) following inventory-item-V2.hbs pattern - Sort domain cards by Foundry's `sort` property in the domainCards getter (character.mjs) following base-actor.mjs pattern for inventory This enables users to reorder domain cards by dragging, with order persistence across page reloads, just like Loot already supports. Fixes: Sorting works for loot, but not the Loadout Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
96f090bef5
commit
5f9407319f
2 changed files with 4 additions and 4 deletions
|
|
@ -411,8 +411,8 @@ export default class DhCharacter extends DhCreature {
|
||||||
|
|
||||||
get domainCards() {
|
get domainCards() {
|
||||||
const domainCards = this.parent.items.filter(x => x.type === 'domainCard');
|
const domainCards = this.parent.items.filter(x => x.type === 'domainCard');
|
||||||
const loadout = domainCards.filter(x => !x.system.inVault);
|
const loadout = domainCards.filter(x => !x.system.inVault).sort((a, b) => a.sort - b.sort);
|
||||||
const vault = domainCards.filter(x => x.system.inVault);
|
const vault = domainCards.filter(x => x.system.inVault).sort((a, b) => a.sort - b.sort);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
loadout: loadout,
|
loadout: loadout,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<li class="card-item" data-item-uuid="{{item.uuid}}" data-type="domainCard">
|
<li class="card-item" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-type="domainCard">
|
||||||
<img src="{{item.img}}" data-action="useItem" class="card-img" />
|
<img src="{{item.img}}" data-action="useItem" class="card-img" draggable="true" />
|
||||||
<span class="item-icon recall-cost">
|
<span class="item-icon recall-cost">
|
||||||
<span class="recall-value">{{item.system.recallCost}}</span>
|
<span class="recall-value">{{item.system.recallCost}}</span>
|
||||||
<i class="fa-solid fa-bolt"></i>
|
<i class="fa-solid fa-bolt"></i>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue