@@ -68,13 +68,13 @@ function reindexKeyCollectionWidget($collectionWidget) { | |||
$(item).find('input,textarea').each(function (y, field) { | |||
let $field = $(field); | |||
//Chanegment ID | |||
let posId = Tools.indexOfLastDigit($field.prop('id')); | |||
let posId = SovTools.indexOfLastDigit($field.prop('id')); | |||
let idPrefix = $field.prop('id').substr(0, posId); | |||
let idSuffix = $field.prop('id').substr(posId + 1); | |||
$field.prop('id', idPrefix + i + idSuffix); | |||
//Chanegment Name | |||
let posName = Tools.indexOfLastDigit($field.prop('name')); | |||
let posName = SovTools.indexOfLastDigit($field.prop('name')); | |||
let namePrefix = $field.prop('name').substr(0, posName); | |||
let nameSuffix = $field.prop('name').substr(posName + 1); | |||
$field.prop('name', namePrefix + i + nameSuffix); |
@@ -2,9 +2,14 @@ | |||
{% set property_name = field.getProperty() %} | |||
{% set id_toggle = 'toggle-'~item.id~'-'~property_name %} | |||
{% block toggle %} | |||
<div class="custom-control custom-switch custom-switch-on-success custom-switch-off-default" | |||
data-url="{{ ea_url({crudAction: 'edit', entityId: item.id, fieldName: property_name }) }}"> | |||
<input type="checkbox" class="custom-control-input" id="{{ id_toggle }}" {{ field.value ? 'checked' }}> | |||
<label class="custom-control-label" for="{{ id_toggle }}"> | |||
{{ field.getCustomOption('toggle_label') ? field.label : field.property|sov_trans_admin_field(entity.instance) }}</label> | |||
</div> | |||
{% block label %} | |||
{{ field.getCustomOption('toggle_label') ? field.label : field.property|sov_trans_admin_field(entity.instance) }} | |||
{% endblock label %} | |||
</label> | |||
</div> | |||
{% endblock toggle %} |
@@ -119,9 +119,12 @@ | |||
{% if not entityNameOrObject and form.parent.vars.errors.form.config.dataClass is defined %} | |||
{% set entityNameOrObject = form.parent.vars.errors.form.config.dataClass %} | |||
{% endif %} | |||
x | |||
{% if translation_domain == null %} | |||
{% set translation_domain = 'admin' %} | |||
{% endif %} | |||
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %} | |||
>{{ (label is not empty and '.' in label) ? label|trans({}, 'admin') : name|sov_trans_admin_field(entityNameOrObject) }} | |||
>{{ (label is not empty and '.' in label) ? label|trans({}, translation_domain) : name|sov_trans_admin_field(entityNameOrObject) }} | |||
</{{ element|default('label') }}> | |||
{%- endif -%} |
@@ -22,7 +22,8 @@ | |||
{% endblock page_actions %} | |||
{% block main %} | |||
<div class="col-12"> | |||
{% block main_prepend %}{% endblock %} | |||
<div class="col-12" id="{% block index_id %}{% endblock index_id %}"> | |||
{# sort can be multiple; let's consider the sorting field the first one #} | |||
{% set sort_field_name = app.request.get('sort')|keys|first %} | |||
{% set sort_order = app.request.get('sort')|first %} | |||
@@ -74,7 +75,6 @@ | |||
{% set ea_sort_asc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::ASC') %} | |||
{% set ea_sort_desc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::DESC') %} | |||
{% for field in fields ?? [] %} | |||
{% set field = field.getAsDto() %} | |||
{% if field.isDisplayedOn('index') %} | |||
@@ -222,6 +222,8 @@ | |||
{{ include('@EasyAdmin/crud/includes/_batch_action_modal.html.twig', {}, with_context = false) }} | |||
{% endif %} | |||
</div> | |||
{% block main_append %}{% endblock %} | |||
{% endblock main %} | |||
{% block body_javascript %} |