Skip to content

Commit

Permalink
feat(item): improve attachments
Browse files Browse the repository at this point in the history
* port changes to attachments

#1215
  • Loading branch information
wrycu committed Jan 13, 2025
1 parent ae745e7 commit ac51b25
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 59 deletions.
1 change: 1 addition & 0 deletions modules/helpers/partial-templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default class TemplateHelpers {
"systems/starwarsffg/templates/parts/actor/ffg-weapon-armor-gear.html",
"systems/starwarsffg/templates/parts/actor/ffg-vehicle-weapon-attachments.html",
"systems/starwarsffg/templates/parts/ffg-qualities-attachments-mods.html",
"systems/starwarsffg/templates/parts/ffg-mods.html",
"systems/starwarsffg/templates/items/dialogs/ffg-mod.html",
"systems/starwarsffg/templates/items/dialogs/ffg-modification.html",
"systems/starwarsffg/templates/parts/actor/ffg-vehicle-cargo.html",
Expand Down
29 changes: 3 additions & 26 deletions templates/items/ffg-itemattachment-sheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,32 +60,9 @@ <h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeh
</div>

<div class="tab additional" data-group="primary" data-tab="additional">
<table>
<thead>
<tr>
<th>Modification</th>
<!-- <th>Count</th> -->
<th>Active</th>
<th><i class="fas fa-plus add-new-item" data-acceptable-type="itemmodifier"></i></th>
</tr>
</thead>
<tbody>
{{#each data.itemmodifier as |item id|}}
<tr>
<td>{{item.name}}</td>
<!-- <td data-item-name="itemmodifier" data-item-index="{{id}}">
<div class="quantity increase"><i class="far fa-plus-square"></i></div>
{{item.system.rank}}
<div class="quantity decrease"><i class="far fa-minus-square"></i></div>
</td> -->
<td data-item-name="itemmodifier" data-item-index="{{id}}">
<div class="modifier-active"><i class="far {{#if item.system.active}} fa-check-square {{else}} fa-square {{/if}}"></i></div>
</td>
<td class="add-modifier" data-item-name="itemmodifier" data-item-index="{{id}}"><i class="fas fa-edit"></i><i class="fas fa-times item-delete"></i></td>
</tr>
{{/each}}
</tbody>
</table>
<div class="attachments items">
{{> "systems/starwarsffg/templates/parts/ffg-mods.html"}}
</div>
</div>

<div class="tab configuration" data-group="primary" data-tab="configuration">
Expand Down
34 changes: 34 additions & 0 deletions templates/parts/ffg-mods.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{!-- qualities List --}}
<ul class="talent-list">
<li class="talents-header flexrow">
<div class="header-name">{{ localize "SWFFG.ItemQualities" }}</div>
<div></div>
</li>
<ul class="items-list">
{{#each data.itemmodifier as |item id|}}
<li class="item flexrow force-power" data-item-id="{{item._id}}" data-desc="{{item.system.description}}" data-upgrade-name="{{item.name}}" data-item-type="itemmodifier" data-item-index="{{ @index }}">
<div class="item-name">
{{item.name}} {{ item.system.rank }}
</div>
<div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each }}

{{!-- qualities added by attachments --}}
{{#each data.itemattachment as |item id|}}
{{#each item.system.itemmodifier as |mod mod_id| }}
{{#if mod.system.active }}
<li class="item flexrow force-power" data-item-id="{{mod._id}}" data-desc="{{mod.system.description}}" data-upgrade-name="{{mod.name}}" data-item-type="itemmodifier" data-item-index="{{ @index }}">
<div class="item-name">
{{!-- render without controls because these are from the attachment --}}
{{mod.name}} {{ mod.system.rank }} ({{ localize "SWFFG.Items.Sheets.Qualities.From" }} {{item.name}})
</div>
</li>
{{/if }}
{{/each }}
{{/each}}
</ul>
</ul>
34 changes: 1 addition & 33 deletions templates/parts/ffg-qualities-attachments-mods.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,4 @@
</ul>
</ul>
{{!-- qualities List --}}
<ul class="talent-list">
<li class="talents-header flexrow">
<div class="header-name">{{ localize "SWFFG.ItemQualities" }}</div>
<div></div>
</li>
<ul class="items-list">
{{#each data.itemmodifier as |item id|}}
<li class="item flexrow force-power" data-item-id="{{item._id}}" data-desc="{{item.system.description}}" data-upgrade-name="{{item.name}}" data-item-type="itemmodifier" data-item-index="{{ @index }}">
<div class="item-name">
{{item.name}} {{ item.system.rank }}
</div>
<div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each }}

{{!-- qualities added by attachments --}}
{{#each data.itemattachment as |item id|}}
{{#each item.system.itemmodifier as |mod mod_id| }}
{{#if mod.system.active }}
<li class="item flexrow force-power" data-item-id="{{mod._id}}" data-desc="{{mod.system.description}}" data-upgrade-name="{{mod.name}}" data-item-type="itemmodifier" data-item-index="{{ @index }}">
<div class="item-name">
{{!-- render without controls because these are from the attachment --}}
{{mod.name}} {{ mod.system.rank }} ({{ localize "SWFFG.Items.Sheets.Qualities.From" }} {{item.name}})
</div>
</li>
{{/if }}
{{/each }}
{{/each}}
</ul>
</ul>
{{> "systems/starwarsffg/templates/parts/ffg-mods.html"}}

0 comments on commit ac51b25

Please sign in to comment.