extracted item control buttons to own templates
- removed code duplication of inline button templates for item and talent overview
This commit is contained in:
parent
e6b51c66a6
commit
177de1a486
5 changed files with 33 additions and 49 deletions
|
@ -38,6 +38,8 @@ async function registerHandlebarsPartials() {
|
||||||
"systems/ds4/templates/item/partials/body.hbs",
|
"systems/ds4/templates/item/partials/body.hbs",
|
||||||
"systems/ds4/templates/actor/partials/items-overview.hbs",
|
"systems/ds4/templates/actor/partials/items-overview.hbs",
|
||||||
"systems/ds4/templates/actor/partials/talents-overview.hbs",
|
"systems/ds4/templates/actor/partials/talents-overview.hbs",
|
||||||
|
"systems/ds4/templates/actor/partials/overview-add-button.hbs",
|
||||||
|
"systems/ds4/templates/actor/partials/overview-control-buttons.hbs",
|
||||||
"systems/ds4/templates/actor/partials/attributes-traits.hbs",
|
"systems/ds4/templates/actor/partials/attributes-traits.hbs",
|
||||||
"systems/ds4/templates/actor/partials/combat-values.hbs",
|
"systems/ds4/templates/actor/partials/combat-values.hbs",
|
||||||
];
|
];
|
||||||
|
|
|
@ -5,29 +5,6 @@
|
||||||
{{!-- INLINE PARTIAL DEFINITIONS --}}
|
{{!-- INLINE PARTIAL DEFINITIONS --}}
|
||||||
{{!-- ======================================================================== --}}
|
{{!-- ======================================================================== --}}
|
||||||
|
|
||||||
{{!--
|
|
||||||
!-- Render an "add" button for a given data type.
|
|
||||||
!--
|
|
||||||
!-- @param datType: hand over the dataType to the partial as hash parameter
|
|
||||||
--}}
|
|
||||||
{{#*inline "addItemButton"}}
|
|
||||||
<div class="item-controls">
|
|
||||||
<a class="item-control item-create" title="Create item" data-type="{{dataType}}">
|
|
||||||
<i class="fas fa-plus"></i>
|
|
||||||
{{localize 'DS4.UserInteractionAddItem'}}</a>
|
|
||||||
</div>
|
|
||||||
{{/inline}}
|
|
||||||
{{!--
|
|
||||||
!-- Render a group of an "edit" and a "delete" button for the current item.
|
|
||||||
!-- The current item is defined by the data-item-id HTML property of the parent li element.
|
|
||||||
--}}
|
|
||||||
{{#*inline "itemControlButtons"}}
|
|
||||||
<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>
|
|
||||||
{{/inline}}
|
|
||||||
|
|
||||||
|
|
||||||
{{!--
|
{{!--
|
||||||
!-- Render a header row for a given data type.
|
!-- Render a header row for a given data type.
|
||||||
|
@ -57,7 +34,7 @@
|
||||||
{{!-- description --}}
|
{{!-- description --}}
|
||||||
<div class="flex4">{{localize 'DS4.HeadingDescription'}}</div>
|
<div class="flex4">{{localize 'DS4.HeadingDescription'}}</div>
|
||||||
{{!-- add button --}}
|
{{!-- add button --}}
|
||||||
{{> addItemButton dataType=dataType }}
|
{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }}
|
||||||
</li>
|
</li>
|
||||||
{{/inline}}
|
{{/inline}}
|
||||||
|
|
||||||
|
@ -94,7 +71,7 @@
|
||||||
{{!-- description --}}
|
{{!-- description --}}
|
||||||
<div class="flex4 item-description">{{{item.data.data.description}}}</div>
|
<div class="flex4 item-description">{{{item.data.data.description}}}</div>
|
||||||
{{!-- control buttons --}}
|
{{!-- control buttons --}}
|
||||||
{{> itemControlButtons}}
|
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
||||||
</li>
|
</li>
|
||||||
{{/inline}}
|
{{/inline}}
|
||||||
|
|
||||||
|
|
11
src/templates/actor/partials/overview-add-button.hbs
Normal file
11
src/templates/actor/partials/overview-add-button.hbs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{{!
|
||||||
|
!-- Render an "add" button for adding an item of given data type.
|
||||||
|
!--
|
||||||
|
!-- @param datType: hand over the dataType to the partial as hash parameter
|
||||||
|
}}
|
||||||
|
<div class="item-controls">
|
||||||
|
<a class="item-control item-create" title="Create item" data-type="{{dataType}}">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
{{localize "DS4.UserInteractionAddItem"}}
|
||||||
|
</a>
|
||||||
|
</div>
|
|
@ -0,0 +1,8 @@
|
||||||
|
{{!--
|
||||||
|
!-- Render a group of an "edit" and a "delete" button for the current item.
|
||||||
|
!-- The current item is defined by the data-item-id HTML property of the parent li element.
|
||||||
|
--}}
|
||||||
|
<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>
|
|
@ -3,30 +3,15 @@
|
||||||
{{!-- ======================================================================== --}}
|
{{!-- ======================================================================== --}}
|
||||||
{{!-- TODO: remove duplicate add and delete button definition --}}
|
{{!-- TODO: remove duplicate add and delete button definition --}}
|
||||||
|
|
||||||
|
|
||||||
{{!--
|
{{!--
|
||||||
!-- Render an "add" button for a given data type.
|
!-- Render an input element for a rank value property of an item.
|
||||||
!--
|
!--
|
||||||
!-- @param datType: hand over the dataType to the partial as hash parameter
|
!-- @param item: the item
|
||||||
|
!-- @param property: the key of the property in item.data.data (if 'base', the max value is set automatically)
|
||||||
|
!-- @param disabled: if given, is placed plainly into the input as HTML property;
|
||||||
|
!-- meant to be set to "disabled" to disable the input element
|
||||||
--}}
|
--}}
|
||||||
{{#*inline "addItemButton"}}
|
|
||||||
<div class="item-controls">
|
|
||||||
<a class="item-control item-create" title="Create item" data-type="{{dataType}}">
|
|
||||||
<i class="fas fa-plus"></i>
|
|
||||||
{{localize 'DS4.UserInteractionAddItem'}}</a>
|
|
||||||
</div>
|
|
||||||
{{/inline}}
|
|
||||||
{{!--
|
|
||||||
!-- Render a group of an "edit" and a "delete" button for the current item.
|
|
||||||
!-- The current item is defined by the data-item-id HTML property of the parent li element.
|
|
||||||
--}}
|
|
||||||
{{#*inline "itemControlButtons"}}
|
|
||||||
<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>
|
|
||||||
{{/inline}}
|
|
||||||
|
|
||||||
|
|
||||||
{{#*inline "talentRankValue"}}
|
{{#*inline "talentRankValue"}}
|
||||||
<input class="item-num-val item-change" data-dtype="Number" type="number" min="0" step="1"
|
<input class="item-num-val item-change" data-dtype="Number" type="number" min="0" step="1"
|
||||||
{{#if (eq property 'base') }}max="{{item.data.data.rank.max}}"{{/if}}
|
{{#if (eq property 'base') }}max="{{item.data.data.rank.max}}"{{/if}}
|
||||||
|
@ -35,6 +20,7 @@
|
||||||
title="{{localize localizeString}}" />
|
title="{{localize localizeString}}" />
|
||||||
{{/inline}}
|
{{/inline}}
|
||||||
|
|
||||||
|
|
||||||
{{!--
|
{{!--
|
||||||
!-- Render a talent list row from a given item.
|
!-- Render a talent list row from a given item.
|
||||||
!-- It is a flexbox with a child for each item value of interest.
|
!-- It is a flexbox with a child for each item value of interest.
|
||||||
|
@ -68,7 +54,7 @@
|
||||||
{{!-- description --}}
|
{{!-- description --}}
|
||||||
<div class="flex4 item-description">{{{item.data.data.description}}}</div>
|
<div class="flex4 item-description">{{{item.data.data.description}}}</div>
|
||||||
{{!-- control buttons --}}
|
{{!-- control buttons --}}
|
||||||
{{> itemControlButtons}}
|
{{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }}
|
||||||
</li>
|
</li>
|
||||||
{{/inline}}
|
{{/inline}}
|
||||||
|
|
||||||
|
@ -88,7 +74,7 @@
|
||||||
{{!-- description --}}
|
{{!-- description --}}
|
||||||
<div class="flex4">{{localize 'DS4.HeadingDescription'}}</div>
|
<div class="flex4">{{localize 'DS4.HeadingDescription'}}</div>
|
||||||
{{!-- add button --}}
|
{{!-- add button --}}
|
||||||
{{> addItemButton dataType='talent' }}
|
{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='talent' }}
|
||||||
</li>
|
</li>
|
||||||
{{#each itemsByType.talent as |item id|}}
|
{{#each itemsByType.talent as |item id|}}
|
||||||
{{> talentListEntry item=item}}
|
{{> talentListEntry item=item}}
|
||||||
|
|
Loading…
Reference in a new issue