ds4/templates/sheets/shared/components/control-button-group.hbs
Alexander Minges 3eaf69f558
fix: remove duplicate action handlers and improve template action generation
- Remove duplicate action handlers (edititem, deleteitem, createitem, etc.) from DS4ActorSheet and DS4ItemSheet
- Fix editImage method reference from static to prototype in DS4ActorSheet
- Add capitalize helper to handlebars-helpers.ts for dynamic action name generation
- Update control-button-group.hbs and add-button.hbs templates to use concat and capitalize helpers
- Ensure consistent camelCase naming for all action handlers (editItem, deleteItem, createItem, etc.)

This resolves action handler conflicts and improves maintainability by using dynamic template generation
instead of hardcoded conditional logic.
2025-07-28 21:55:06 +02:00

22 lines
1.1 KiB
Handlebars

{{!--
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 a corresponding id attribute 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">
{{#if @root/editable}}
<a class="ds4-control-button-group__button" data-action="{{concat 'edit' (capitalize documentType)}}" data-document-type="{{documentType}}"
title="{{localize editTitle}}"><i class="fas fa-edit"></i></a>
<a class="ds4-control-button-group__button" data-action="{{concat 'delete' (capitalize documentType)}}" data-document-type="{{documentType}}"
title="{{localize deleteTitle}}"><i class="fas fa-trash"></i></a>
{{/if}}
</div>