Add possibility to delete and edit effects in the actor sheet

This commit is contained in:
Johannes Loher 2021-07-22 02:02:35 +02:00
parent 4d2a7d1686
commit 808dab7f5a
15 changed files with 91 additions and 51 deletions

View file

@ -7,12 +7,13 @@ SPDX-License-Identifier: MIT
{{!
!-- Render an "add" button.
!-- @param class: The css class to use for the link element
!-- @param documentType: The type of document this button controls, item or effect
!-- @param title: The title to use for the link element (will be localized)
!-- @param type: An optional property to use as data-type attribute
}}
<div>
<a class="{{class}}" title="{{localize title}}" {{#if type}}data-type="{{type}}" {{/if}}>
<a class="control-{{documentType}} {{documentType}}-create" title="{{localize title}}" data-action="create" {{#if
type}}data-type="{{type}}" {{/if}}>
<i class="fas fa-plus"></i>
{{localize "DS4.UserInteractionAdd"}}
</a>

View file

@ -0,0 +1,20 @@
{{!--
SPDX-FileCopyrightText: 2021 Johannes Loher
SPDX-FileCopyrightText: 2021 Gesina Schwalbe
SPDX-License-Identifier: MIT
--}}
{{!--
!-- Render a group of an "edit" and a "delete" button.
!-- The current item is defined by the data-item-id HTML property of the parent li element.
!-- @param documentType: The type of document that is controlled by this button group, item or effect
!-- @param editTitle: The title to use for the edit link element (will be localized)
!-- @param deleteTitle: The title to use for the delete link element (will be localized)
--}}
<div class="ds4-control-button-group">
<a class="ds4-control-button-group__button control-{{documentType}} {{documentType}}-edit" data-action="edit"
title="{{localize editTitle}}"><i class="fas fa-edit"></i></a>
<a class="ds4-control-button-group__button control-{{documentType}} {{documentType}}-delete" data-action="delete"
title="{{localize deleteTitle}}"><i class="fas fa-trash"></i></a>
</div>

View file

@ -9,7 +9,7 @@ SPDX-License-Identifier: MIT
!-- Render an effect list entry row.
!-- @param effectData: The data of the item.
--}}
<li class="ds4-effect-list__row item" data-item-id="{{itemData._id}}">
<li class="ds4-effect-list__row effect" data-effect-id="{{effectData._id}}">
{{!-- enabled --}}
<input class="ds4-effect-list__editable ds4-effect-list__editable--checkbox effect-change" type="checkbox" {{checked
(ne effectData.disabled)}} data-dtype="Boolean" data-property="disabled"
@ -25,7 +25,7 @@ SPDX-License-Identifier: MIT
{{!-- source name --}}
<div>{{effectData.sourceName}}</div>
{{!-- control buttons --}}
{{> systems/ds4/templates/sheets/actor/components/overview-control-buttons.hbs
class="ds4-effect-list__control-buttons" }}
{{!-- control button group --}}
{{> systems/ds4/templates/sheets/actor/components/control-button-group.hbs documentType="effect"
editTitle="DS4.UserInteractionEditEffectTitle" deleteTitle="DS4.UserInteractionDeleteEffectTitle"}}
</li>

View file

@ -49,7 +49,7 @@ SPDX-License-Identifier: MIT
{{{itemData.data.description}}}</div>
{{/unless}}
{{!-- control buttons --}}
{{> systems/ds4/templates/sheets/actor/components/overview-control-buttons.hbs
class="ds4-item-list__control-buttons" }}
{{!-- control button group --}}
{{> systems/ds4/templates/sheets/actor/components/control-button-group.hbs documentType="item"
editTitle="DS4.UserInteractionEditItemTitle" deleteTitle="DS4.UserInteractionDeleteItemTitle"}}
</li>

View file

@ -42,7 +42,7 @@ SPDX-License-Identifier: MIT
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='weapon'}}
documentType='item' type='weapon'}}
{{!-- ARMOR --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeArmorPlural'}}</h4>
@ -81,7 +81,7 @@ class='item-create' type='weapon'}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='armor'}}
documentType='item' type='armor'}}
{{!-- SHIELD --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeShieldPlural'}}</h4>
@ -103,7 +103,7 @@ class='item-create' type='armor'}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='shield'}}
documentType='item' type='shield'}}
{{!-- EQUIPMENT --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeEquipmentPlural'}}</h4>
@ -124,7 +124,7 @@ class='item-create' type='shield'}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='equipment'}}
documentType='item' type='equipment'}}
{{!-- LOOT --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeLootPlural'}}</h4>
@ -144,4 +144,4 @@ class='item-create' type='equipment'}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='loot'}}
documentType='item' type='loot'}}

View file

@ -1,18 +0,0 @@
{{!--
SPDX-FileCopyrightText: 2021 Johannes Loher
SPDX-FileCopyrightText: 2021 Gesina Schwalbe
SPDX-License-Identifier: MIT
--}}
{{!--
!-- 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.
!-- @param class: Additional CSS class(es) for the controls
--}}
<div class="item-controls {{class}}">
<a class="item-control item-edit" title="{{localize 'DS4.UserInteractionEditItemTitle'}}"><i
class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="{{localize 'DS4.UserInteractionDeleteItemTitle'}}"><i
class="fas fa-trash"></i></a>
</div>

View file

@ -23,7 +23,7 @@ SPDX-License-Identifier: MIT
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='talent'}}
documentType='item' type='talent'}}
{{!-- RACIAL ABILITY --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeRacialAbilityPlural'}}</h4>
@ -36,7 +36,7 @@ SPDX-License-Identifier: MIT
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='racialAbility'}}
documentType='item' type='racialAbility'}}
{{!-- LANGUAGE --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeLanguagePlural'}}</h4>
@ -49,7 +49,7 @@ SPDX-License-Identifier: MIT
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='language'}}
documentType='item' type='language'}}
{{!-- ALPHABET --}}
<h4 class="ds4-item-list-title">{{localize 'DS4.ItemTypeAlphabetPlural'}}</h4>
@ -62,5 +62,5 @@ SPDX-License-Identifier: MIT
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='alphabet'}}
documentType='item' type='alphabet'}}
</div>

View file

@ -15,5 +15,5 @@ SPDX-License-Identifier: MIT
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddEffectTitle'
class='effect-create'}}
documentType='effect'}}
</div>

View file

@ -15,5 +15,5 @@ SPDX-License-Identifier: MIT
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='specialCreatureAbility'}}
documentType='item' type='specialCreatureAbility'}}
</div>

View file

@ -94,5 +94,5 @@ titleKey=titleKey}}
</ol>
{{/unless}}
{{> systems/ds4/templates/sheets/actor/components/add-button.hbs title='DS4.UserInteractionAddItemTitle'
class='item-create' type='spell'}}
documentType='item' type='spell'}}
</div>