|
24 | 24 | })|e('html_attr') }}" |
25 | 25 | > |
26 | 26 | {% set should_show_first = true %} |
| 27 | + {% set is_field_definitions_draggable = is_draggable ?? true %} |
27 | 28 |
|
28 | 29 | {% for field_defintions in grouped_field_defintions %} |
29 | 30 | {% if field_defintions is not empty %} |
|
36 | 37 | 'ibexa-collapse--field-definitions-group ibexa-field-definitions-group-%s'|format(id), |
37 | 38 | field_defintions is empty and not loop.first or loop.first and not should_show_first and field_defintions is empty ? 'ibexa-collapse--hidden' |
38 | 39 | ] %} |
39 | | - {% set is_field_definition_draggable = is_draggable ?? true %} |
40 | 40 |
|
41 | 41 | {%- embed "@ibexadesign/ui/component/collapse.html.twig" with { |
42 | 42 | 'class': field_definitions_group_class|join(' '), |
|
57 | 57 | } -%} |
58 | 58 | {% block body_content_wrapper %} |
59 | 59 | <div |
60 | | - class="ibexa-collapse__body-content ibexa-content-type-edit__field-definition-drop-zone" |
| 60 | + class="ibexa-collapse__body-content {% if is_field_definitions_draggable %}ibexa-content-type-edit__field-definition-drop-zone{% endif %}" |
61 | 61 | data-placeholder="{{ include('@ibexadesign/content_type/field_definitions_placeholder.html.twig')|e('html_attr') }}" |
62 | 62 | > |
63 | 63 | {% block body_content %} |
64 | 64 | {%- include "@ibexadesign/content_type/field_definitions_empty_group.html.twig" -%} |
65 | 65 |
|
66 | 66 | {% for field_definition in field_defintions %} |
67 | | - {{ include('@ibexadesign/content_type/field_definition.html.twig', { is_draggable: is_field_definition_draggable }) }} |
| 67 | + {{ include('@ibexadesign/content_type/field_definition.html.twig', { is_draggable: is_field_definitions_draggable }) }} |
68 | 68 | {% endfor %} |
69 | 69 | {% endblock %} |
70 | 70 | </div> |
71 | 71 | {% endblock %} |
72 | 72 | {%- endembed -%} |
73 | 73 | {% endfor %} |
74 | 74 | </div> |
75 | | - |
76 | 75 | <div class="ibexa-content-type-edit__add-field-definitions-group"> |
77 | | - <button type="button" class="ibexa-content-type-edit__add-field-definitions-group-btn btn ibexa-btn ibexa-btn ibexa-btn--info"> |
| 76 | + <button |
| 77 | + type="button" |
| 78 | + class="ibexa-content-type-edit__add-field-definitions-group-btn btn ibexa-btn ibexa-btn ibexa-btn--info" |
| 79 | + data-is-disabled="{{ is_field_definitions_draggable ? 'false' : 'true' }}" |
| 80 | + > |
78 | 81 | <svg class="ibexa-icon ibexa-icon--small"> |
79 | 82 | <use xlink:href="{{ ibexa_icon_path('create') }}"></use> |
80 | 83 | </svg> |
|
84 | 87 | {{ include('@ibexadesign/ui/component/popup_menu/popup_menu.html.twig', { |
85 | 88 | 'items': grouped_field_defintions|keys|map(group => { |
86 | 89 | 'label': group | ibexa_field_group_name, |
87 | | - 'content_class': grouped_field_defintions[group] is not empty or (group is same as(grouped_field_defintions|keys|first) and should_show_first) |
88 | | - ? 'ibexa-popup-menu__item-content--disabled ' |
| 90 | + 'content_class': grouped_field_defintions[group] is not empty or (group is same as(grouped_field_defintions|keys|first) and should_show_first) |
| 91 | + ? 'ibexa-popup-menu__item-content--disabled ' |
89 | 92 | : '', |
90 | 93 | 'action_attr': { |
91 | 94 | 'data-related-collapse-selector': '.ibexa-field-definitions-group-' ~ group |
|
0 commit comments