|
@@ -14,22 +14,17 @@ file that was distributed with this source code.
|
|
|
{{ element|render_relation_element(sonata_admin.field_description) }}
|
|
|
{% endfor %}
|
|
|
{% else %}
|
|
|
- <div id="field_container_{{ form.vars.id }}">
|
|
|
- <span id="field_widget_{{ form.vars.id }}" >
|
|
|
- {% if sonata_admin.field_description.options.edit == 'inline' %}
|
|
|
- {% if sonata_admin.field_description.options.inline == 'table' %}
|
|
|
+ <div id="field_container_{{ id }}">
|
|
|
+ <span id="field_widget_{{ id }}" >
|
|
|
+ {% if sonata_admin.edit == 'inline' %}
|
|
|
+ {% if sonata_admin.inline == 'table' %}
|
|
|
<table>
|
|
|
<tbody class="sonata-ba-tbody">
|
|
|
{% for nested_group_field_name, nested_group_field in form.children %}
|
|
|
<tr>
|
|
|
{% for field_name, nested_field in nested_group_field.children %}
|
|
|
- <td class="sonata-ba-td-{{ form.vars.id }}-{{ field_name }}">
|
|
|
+ <td class="sonata-ba-td-{{ id }}-{{ field_name }}">
|
|
|
{% if sonata_admin.field_description.associationadmin.formfielddescriptions[field_name] is defined %}
|
|
|
- {#{{ sonata_admin.field_description.associationadmin.formfielddescriptions[field_name]|render_form_element(#}
|
|
|
- {#nested_group_field,#}
|
|
|
- {#value[nested_group_field_name]#}
|
|
|
- {#) }}#}
|
|
|
-
|
|
|
{{ form_widget(nested_field) }}
|
|
|
|
|
|
{% set dummy = nested_group_field.setrendered %}
|
|
@@ -51,14 +46,6 @@ file that was distributed with this source code.
|
|
|
'inline': 'natural',
|
|
|
'edit' : 'inline'
|
|
|
}) }}
|
|
|
- {#{{ sonata_admin.field_description.associationadmin.formfielddescriptions[field_name]|render_form_element(#}
|
|
|
- {#nested_group_field,#}
|
|
|
- {#value, {#}
|
|
|
- {#'inline': 'natural',#}
|
|
|
- {#'edit' : 'inline'#}
|
|
|
- {#}#}
|
|
|
- {#) }}#}
|
|
|
-
|
|
|
{% set dummy = nested_group_field.setrendered %}
|
|
|
{% else %}
|
|
|
{{ form_widget(nested_field) }}
|
|
@@ -73,11 +60,11 @@ file that was distributed with this source code.
|
|
|
|
|
|
</span>
|
|
|
|
|
|
- {% if sonata_admin.field_description.options.edit == 'inline' %}
|
|
|
- <span id="field_actions_{{ form.vars.id }}" >
|
|
|
+ {% if sonata_admin.edit == 'inline' %}
|
|
|
+ <span id="field_actions_{{ id }}" >
|
|
|
<a
|
|
|
href="{{ sonata_admin.field_description.associationadmin.generateUrl('create') }}"
|
|
|
- onclick="start_field_retrieve_{{ form.vars.id }}(event)"
|
|
|
+ onclick="start_field_retrieve_{{ id }}(event)"
|
|
|
class="sonata-ba-action"
|
|
|
style="{% if not sonata_admin.field_description.associationadmin.isGranted('CREATE')%}display:none{% endif %}"
|
|
|
>
|
|
@@ -91,34 +78,34 @@ file that was distributed with this source code.
|
|
|
{# add code for the sortable options #}
|
|
|
{% if sonata_admin.field_description.options.sortable is defined %}
|
|
|
<script>
|
|
|
- jQuery('div#field_container_{{ form.vars.id }} tbody.sonata-ba-tbody').sortable({
|
|
|
+ jQuery('div#field_container_{{ id }} tbody.sonata-ba-tbody').sortable({
|
|
|
axis: 'y',
|
|
|
opacity: 0.6,
|
|
|
items: 'tr',
|
|
|
- stop: apply_position_value_{{ form.vars.id }}
|
|
|
+ stop: apply_position_value_{{ id }}
|
|
|
});
|
|
|
|
|
|
- function apply_position_value_{{ form.vars.id }}() {
|
|
|
+ function apply_position_value_{{ id }}() {
|
|
|
// update the input value position
|
|
|
- jQuery('div#field_container_{{ form.vars.id }} tbody.sonata-ba-tbody td.sonata-ba-td-{{ form.vars.id }}-position').each(function(index, element) {
|
|
|
+ jQuery('div#field_container_{{ id }} tbody.sonata-ba-tbody td.sonata-ba-td-{{ id }}-position').each(function(index, element) {
|
|
|
// remove the sortable handler and put it back
|
|
|
jQuery('span.sonata-ba-sortable-handler', element).remove();
|
|
|
jQuery(element).append('<span class="sonata-ba-sortable-handler ui-icon ui-icon-grip-solid-horizontal"></span>');
|
|
|
jQuery('input', element).hide();
|
|
|
});
|
|
|
|
|
|
- jQuery('div#field_container_{{ form.vars.id }} tbody.sonata-ba-tbody td.sonata-ba-td-{{ form.vars.id }}-position input').each(function(index, value) {
|
|
|
+ jQuery('div#field_container_{{ id }} tbody.sonata-ba-tbody td.sonata-ba-td-{{ id }}-position input').each(function(index, value) {
|
|
|
jQuery(value).val(index + 1);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// refresh the sortable option when a new element is added
|
|
|
- jQuery('#sonata-ba-field-container-{{ form.vars.id }}').bind('sonata.add_element', function() {
|
|
|
- apply_position_value_{{ form.vars.id }}();
|
|
|
- jQuery('div#field_container_{{ form.vars.id }} tbody.sonata-ba-tbody').sortable('refresh');
|
|
|
+ jQuery('#sonata-ba-field-container-{{ id }}').bind('sonata.add_element', function() {
|
|
|
+ apply_position_value_{{ id }}();
|
|
|
+ jQuery('div#field_container_{{ id }} tbody.sonata-ba-tbody').sortable('refresh');
|
|
|
});
|
|
|
|
|
|
- apply_position_value_{{ form.vars.id }}();
|
|
|
+ apply_position_value_{{ id }}();
|
|
|
|
|
|
</script>
|
|
|
{% endif %}
|
|
@@ -127,10 +114,10 @@ file that was distributed with this source code.
|
|
|
{% include 'SonataAdminBundle:CRUD:edit_orm_one_association_script.html.twig' %}
|
|
|
|
|
|
{% else %}
|
|
|
- <span id="field_actions_{{ form.vars.id }}" >
|
|
|
+ <span id="field_actions_{{ id }}" >
|
|
|
<a
|
|
|
href="{{ sonata_admin.field_description.associationadmin.generateUrl('create') }}"
|
|
|
- onclick="start_field_dialog_form_add_{{ form.vars.id }}(event)"
|
|
|
+ onclick="start_field_dialog_form_add_{{ id }}(event)"
|
|
|
class="sonata-ba-action"
|
|
|
style="{% if not sonata_admin.field_description.associationadmin.isGranted('CREATE')%}display:none{% endif %}"
|
|
|
>
|
|
@@ -141,7 +128,7 @@ file that was distributed with this source code.
|
|
|
</a>
|
|
|
</span>
|
|
|
|
|
|
- <div style="display: none" id="field_dialog_{{ form.vars.id }}">
|
|
|
+ <div style="display: none" id="field_dialog_{{ id }}">
|
|
|
|
|
|
</div>
|
|
|
|