КОНТРОЛЫ/chained_list.md
Исходный код
Twig код
<div class="control-chained-list js-control-chained-list {{ class_name }}">
{#
эта переменная отвечает за то, показывать ли
инпут следующего списка
первый элемент нам в любом случае надо показать
#}
{% set last_list_has_value = true %}
{% for list in lists %}
{% set hidden = not values[list.catalog_id] and not last_list_has_value %}
{% set suggest_class_name = 'control-chained-list__suggest' ~ (hidden ? ' hidden' : '') %}
{% if not hidden and not values[list.catalog_id].value %}
{% set suggest_class_name = suggest_class_name ~ ' control-chained-list__suggest_empty' %}
{% endif %}
{% if loop.first %}
{% set suggest_class_name = suggest_class_name ~ ' control-chained-list__suggest_first' %}
{% endif %}
{% if loop.last %}
{% set suggest_class_name = suggest_class_name ~ ' control-chained-list__suggest_last' %}
{% endif %}
<input type="hidden" name="{{ name ~ '[' ~ list.catalog_id ~ ']' }}" value="{{ values[list.catalog_id].value }}" class="js-control-changed-list-chain-value {{ value_input_class_name|default('')}} " data-catalog-id="{{ list.catalog_id }}">
{% include "interface/controls/suggest.twig" with {
class_name: suggest_class_name,
input_class_name: input_class_name|default('') ~ ' js-form-changes-skip text-input-visible-placeholder',
placeholder: list.title,
additional_data: 'data-catalog-id="' ~ list.catalog_id ~ '" data-parent-element-id="' ~ (last_list_has_value > 0 ? last_list_has_value : '') ~ '" data-placeholder="' ~ list.title ~ '"',
value: values[list.catalog_id].name,
disabled: disabled
} only %}
{% set last_list_has_value = values[list.catalog_id].value %}
{% endfor %}
<script type="application/json">
{{ lists|json_encode|raw }}
</script>
</div>
Ссылка на вики репозиторий
- Страницы
- add_button
- budget
- button
- cancel_button
- chained_list
- checkbox
- checkboxes_dropdown
- checkboxes_dropdown_single
- checkboxes_string
- color_picker
- contenteditable
- date_field
- date_filter
- date_time_field
- deadline_select
- delete_button
- drive_field
- feed_note_main_buttons
- file
- input
- legal_entity
- line_toggler
- multiselect
- payer
- phone
- pipeline_toggler
- radio
- responsive_toggler
- select
- select_with_subtext
- smart_address
- status_chat
- suggest
- supplier
- switcher
- tags
- textarea
- textarea_code
- time
- time_field
- toggler
- updater
- users
- wysiwyg
Ссылка на вики репозиторий
- add_button
- budget
- button
- cancel_button
- chained_list
- checkbox
- checkboxes_dropdown
- checkboxes_dropdown_single
- checkboxes_string
- color_picker
- contenteditable
- date_field
- date_filter
- date_time_field
- deadline_select
- delete_button
- drive_field
- feed_note_main_buttons
- file
- input
- legal_entity
- line_toggler
- multiselect
- payer
- phone
- pipeline_toggler
- radio
- responsive_toggler
- select
- select_with_subtext
- smart_address
- status_chat
- suggest
- supplier
- switcher
- tags
- textarea
- textarea_code
- time
- time_field
- toggler
- updater
- users
- wysiwyg