mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-25 21:34:12 +01:00
142 lines
6.3 KiB
Twig
142 lines
6.3 KiB
Twig
{% use "application/forms/itop_base_layout.html.twig" %}
|
|
|
|
{# Widgets #}
|
|
|
|
{%- block widget_attributes -%}
|
|
{{- parent() -}}
|
|
{% if trigger_form_submit_on_modify %}
|
|
onChange="triggerTurbo(this);"
|
|
{% endif %}
|
|
{%- endblock widget_attributes -%}
|
|
|
|
{%- block form_widget_simple -%}
|
|
{% if type == 'text' %}{% set ibo_class='ibo-input-string' %}{% else %}{% set ibo_class='ibo-input-' ~ type %}{% endif %}
|
|
{% set attr = attr|merge({class: (attr.class|default('') ~ ' ibo-input ' ~ ibo_class)|trim}) %}
|
|
{{- parent() -}}
|
|
{%- endblock form_widget_simple -%}
|
|
|
|
{%- block textarea_widget -%}
|
|
{% if type == 'text' %}{% set ibo_class='ibo-input-string' %}{% else %}{% set ibo_class='ibo-input-' ~ type %}{% endif %}
|
|
{% set attr = attr|merge({class: (attr.class|default('') ~ ' ibo-input ' ~ ibo_class)|trim}) %}
|
|
{{- parent() -}}
|
|
{%- endblock textarea_widget -%}
|
|
|
|
{%- block choice_widget_collapsed -%}
|
|
{% set attr = attr|merge({class: (attr.class|default('') ~ ' ibo-input')|trim}) %}
|
|
<select is="choices-element" class="field_autocomplete ibo-input ibo-input-select ibo-input-select-autocomplete ui-autocomplete-input"
|
|
{{ block('widget_attributes') }}
|
|
{% if multiple %} multiple="multiple" {% endif %}
|
|
{% if max_items_selected is defined %} data-tom-select-max-items-selected="{{ max_items_selected }}" {% endif %}
|
|
{% if disable_auto_complete %} data-tom-select-disable-auto-complete=true {% endif %}
|
|
{% if placeholder is not none %} hidePlaceholder=false {% endif %}
|
|
>
|
|
{%- if placeholder is not none -%}
|
|
<option value=""{% if placeholder_attr|default({}) %}{% with { attr: placeholder_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder != '' ? (translation_domain is same as(false) ? placeholder : placeholder|trans({}, translation_domain)) }}</option>
|
|
{%- endif -%}
|
|
{%- if preferred_choices|length > 0 -%}
|
|
{% set options = preferred_choices %}
|
|
{% set render_preferred_choices = true %}
|
|
{{- block('choice_widget_options') -}}
|
|
{%- if choices|length > 0 and separator is not none -%}
|
|
<option disabled="disabled">{{ separator }}</option>
|
|
{%- endif -%}
|
|
{%- endif -%}
|
|
{%- set options = choices -%}
|
|
{%- set render_preferred_choices = false -%}
|
|
{{- block('choice_widget_options') -}}
|
|
</select>
|
|
{%- endblock choice_widget_collapsed -%}
|
|
|
|
{%- block choice_widget_expanded -%}
|
|
<div {{ block('widget_container_attributes') }}>
|
|
{%- for child in form %}
|
|
{{- form_widget(child) -}}
|
|
{{- form_label(child, null, {translation_domain: choice_translation_domain, no_label_class: true}) -}}
|
|
{% endfor -%}
|
|
</div>
|
|
{%- endblock choice_widget_expanded -%}
|
|
|
|
{%- block form_label -%}
|
|
{%- set no_legend_element = inline_display is defined and inline_display -%}
|
|
{%- if compound is defined and compound and not no_legend_element -%}
|
|
{%- set element = 'legend' -%}
|
|
{%- elseif no_label_class is not defined or not no_label_class -%}
|
|
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ibo-field--label')|trim}) %}
|
|
{%- endif -%}
|
|
{{- parent() -}}
|
|
{%- endblock form_label -%}
|
|
|
|
{%- block form_rows -%}
|
|
|
|
{% for block in blocks %}
|
|
<div id="turbo_{{ block.id }}" class="ibo-field ibo-content-block ibo-block ibo-field-small">
|
|
{% if block.added == 1 %}
|
|
{{ form_row(form[block.name]) }}
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
|
|
{%- endblock form_rows -%}
|
|
|
|
{%- block collection_widget -%}
|
|
|
|
{% if prototype is defined and not prototype.rendered %}
|
|
{%- set prototype_html = '<collection-entry-element data-allow-delete="' ~ allow_delete ~ '" data-allow-ordering="' ~ allow_ordering ~'" data-new="true">' ~ form_widget(prototype) ~'</collection-entry-element>' -%}
|
|
{%- set attr = attr|merge({'data-prototype': prototype_html, 'class': name, 'data-index': form|length > 0 ? form|last.vars.name + 1 : 0 }) -%}
|
|
{% endif %}
|
|
|
|
<collection-element {{ block('widget_container_attributes') }}>
|
|
{% if allow_add %}
|
|
<button type="button" class="add_item_link ibo-button ibo-button ibo-is-regular " data-collection-holder-class="{{ name }}">{{ button_label|dict_s }}</button>
|
|
{% endif %}
|
|
<div role="list">
|
|
{% for child in form %}
|
|
<collection-entry-element data-allow-delete="{{ allow_delete }}" data-allow-ordering="{{ allow_ordering }}">
|
|
{{ form_widget(child) }}
|
|
</collection-entry-element>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
</collection-element>
|
|
|
|
{%- endblock collection_widget -%}
|
|
|
|
{%- block form_label_content -%}
|
|
{{- parent() -}}
|
|
<div style="float: right;display: flex;flex-direction: column;align-items: center;row-gap: 3px;margin-top: 5px;">
|
|
<span role="marquee" class="ibo-button--icon fas" style="padding:6px;"></span>
|
|
</div>
|
|
{%-endblock form_label_content -%}
|
|
|
|
{%- block form_row -%}
|
|
{% set row_attr = row_attr|merge({class: (row_attr.class|default('') ~ ' ibo-field ibo-content-block ibo-block ibo-field-small')|trim}) %}
|
|
{{- parent() -}}
|
|
{%- endblock form_row -%}
|
|
|
|
{%- block form_errors -%}
|
|
<div id="turbo_error_{{ form.vars.id }}" class="form-error">
|
|
{{- parent() -}}
|
|
</div>
|
|
{%- endblock form_errors -%}
|
|
|
|
{%- block oql_form_widget -%}
|
|
<textarea is="oql-element" {{ block('widget_attributes') }}>{{ value }}</textarea>
|
|
{%- endblock oql_form_widget -%}
|
|
|
|
{%- block oql_form_row -%}
|
|
{{- form_row(form) -}}
|
|
<div style="text-align: right">
|
|
{% if with_ai_button is defined and with_ai_button %}
|
|
<button class="ibo-button ibo-button ibo-block ibo-is-alternative ibo-is-neutral " data-role="ibo-button" type="button" name="AI" value="" aria-label="AI">
|
|
<span class="ibo-button--icon fas fa-magic"></span>
|
|
Use AI assistant
|
|
</button>
|
|
{% endif %}
|
|
<button class="ibo-button ibo-button ibo-block ibo-is-alternative ibo-is-neutral " data-role="ibo-button" type="button" name="Book" value="" aria-label="AI">
|
|
<span class="ibo-button--icon fas fa-book"></span>
|
|
Open query phrase book
|
|
</button>
|
|
</div>
|
|
{%- endblock oql_form_row -%}
|
|
|