Add a blue dot to the collection type delete buttons in forms to indicate that this element was not yet saved to DB yet

This commit is contained in:
Jan Böhmer 2023-11-20 21:47:34 +01:00
parent 87626589a3
commit c5435df6f9
4 changed files with 36 additions and 7 deletions

View file

@ -29,4 +29,13 @@
{% macro delete_btn() %}
{{ stimulus_action('elements/collection_type', 'deleteElement') }}
{% endmacro %}
{% macro new_element_indicator(value) %}
{% if value.id is not defined or value.id is null %}
<span class="position-absolute top-0 start-100 translate-middle p-2 bg-primary border border-light rounded-circle"
title="{% trans %}collection_type.new_element.tooltip{% endtrans %}">
<span class="visually-hidden">New alerts</span>
</span>
{% endif %}
{% endmacro %}

View file

@ -50,8 +50,9 @@
{{ form_errors(form.name) }}
</td>
<td>
<button type="button" class="btn btn-danger lot_btn_delete" {{ collection.delete_btn() }}>
<button type="button" class="btn btn-danger lot_btn_delete position-relative" {{ collection.delete_btn() }}>
<i class="fas fa-trash-alt fa-fw"></i>
{{ collection.new_element_indicator(value) }}
</button>
{{ form_errors(form) }}
</td>

View file

@ -14,9 +14,10 @@
</td>
<td>{{ form_widget(form.price_related_quantity, {'attr': {'class': 'form-control-sm'}}) }} {{ form_errors(form.price_related_quantity) }}</td>
<td>
<button type="button" class="btn btn-danger order_btn_delete btn-sm" title="{% trans %}orderdetail.delete{% endtrans %}"
<button type="button" class="btn btn-danger order_btn_delete btn-sm position-relative" title="{% trans %}orderdetail.delete{% endtrans %}"
{{ collection.delete_btn() }}>
<i class="fas fa-trash-alt fa-fw"></i>
{{ collection.new_element_indicator(value) }}
</button>
{{ form_errors(form) }}
</td>
@ -57,8 +58,9 @@
</div>
</td>
<td>
<button type="button" class="btn btn-danger order_btn_delete" {{ collection.delete_btn() }} title="{% trans %}orderdetail.delete{% endtrans %}">
<button type="button" class="btn btn-danger order_btn_delete position-relative" {{ collection.delete_btn() }} title="{% trans %}orderdetail.delete{% endtrans %}">
<i class="fas fa-trash-alt fa-fw"></i>
{{ collection.new_element_indicator(value) }}
</button>
{{ form_errors(form) }}
</td>
@ -77,8 +79,10 @@
<td>{{ form_widget(form.value_text) }}{{ form_errors(form.value_text) }}</td>
<td>{{ form_widget(form.group) }}{{ form_errors(form.group) }}</td>
<td>
<button type="button" class="btn btn-danger btn-sm order_btn_delete {% if form.parent.vars.allow_delete is defined and not form.parent.vars.allow_delete %}disabled{% endif %}" {{ collection.delete_btn() }} title="{% trans %}orderdetail.delete{% endtrans %}">
<button type="button" class="btn btn-danger btn-sm order_btn_delete position-relative {% if form.parent.vars.allow_delete is defined and not form.parent.vars.allow_delete %}disabled{% endif %}"
{{ collection.delete_btn() }} title="{% trans %}orderdetail.delete{% endtrans %}">
<i class="fas fa-trash-alt fa-fw"></i>
{{ collection.new_element_indicator(value) }}
</button>
{{ form_errors(form) }}
</td>
@ -108,9 +112,10 @@
</div>
</td>
<td>
<button type="button" class="btn btn-danger lot_btn_delete" {{ collection.delete_btn() }}>
<button type="button" class="btn btn-danger lot_btn_delete position-relative" {{ collection.delete_btn() }}>
<i class="fas fa-trash-alt fa-fw"></i>
{% trans %}part_lot.delete{% endtrans %}
{{ collection.new_element_indicator(value) }}
</button>
{{ form_errors(form) }}
</td>
@ -140,9 +145,10 @@
</td>
<td>
<button type="button" class="btn btn-danger lot_btn_delete" {{ collection.delete_btn() }}>
<button type="button" class="btn btn-danger lot_btn_delete position-relative" {{ collection.delete_btn() }}>
<i class="fas fa-trash-alt fa-fw"></i>
{% trans %}attachment.delete{% endtrans %}
{{ collection.new_element_indicator(value) }}
</button>
{% set attach = form.vars.value %}
@ -210,9 +216,10 @@
</div>
</td>
<td>
<button type="button" class="btn btn-danger lot_btn_delete" {{ collection.delete_btn() }}>
<button type="button" class="btn btn-danger lot_btn_delete position-relative" {{ collection.delete_btn() }}>
<i class="fas fa-trash-alt fa-fw"></i>
{% trans %}part_lot.delete{% endtrans %}
{{ collection.new_element_indicator(value) }}
</button>
{{ form_errors(form) }}
</td>

View file

@ -11957,5 +11957,17 @@ Please note, that you can not impersonate a disabled user. If you try you will g
<target>Stocked amount</target>
</segment>
</unit>
<unit id="hfwUcM0" name="collection_type.new_element">
<segment>
<source>collection_type.new_element</source>
<target>collection_type.new_element</target>
</segment>
</unit>
<unit id="2NZFail" name="collection_type.new_element.tooltip">
<segment>
<source>collection_type.new_element.tooltip</source>
<target>This element was newly created and was not persisted to the database yet.</target>
</segment>
</unit>
</file>
</xliff>