Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Implement `Field` question type for new GLPI forms
- Bind the answers to the `Field` question type to the corresponding additional fields
- Update dropdowns layout/style for “GLPI Item” fields

## [1.22.2] - 2025-10-24

Expand Down
10 changes: 5 additions & 5 deletions public/css/fields.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ div.fields_clear {
border-radius: 0;
}

[data-glpi-form-editor-question-type-specific]:has(.glpi-fields-plugin-question-type-glpi-item-field),
[data-glpi-form-renderer-fields-question-type-specific-container]:has(.glpi-fields-plugin-question-type-glpi-item-field) {
&:has(> div > span select[data-select2-id]) {
> div:first-of-type .select2-selection {
.glpi-fields-plugin-glpi-item-field,
.glpi-fields-plugin-glpi-item-field .field-container {
&:has(> span select[data-select2-id]) {
> span:first-of-type .select2-selection {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}

> div:not(:first-of-type) {
> span:not(:first-of-type) {
.glpi-fields-plugin-question-type-glpi-item-field {
width: 100%;
}
Expand Down
58 changes: 21 additions & 37 deletions templates/fields.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,7 @@
<div class="w-100"></div>
{% endif %}

{{ macros.dropdownArrayField(itemtype_input_name, value.itemtype|default(''), field['allowed_values'], label, field_options|merge({
'rand': rand,
'display_emptychoice': true,
})) }}

{% set items_id_container_class = ['col-12'] %}
{% if item is instanceof('Glpi\\Form\\Form') %}
{% set items_id_container_class = items_id_container_class|merge(['col-sm-6']) %}
{% else %}
{% set items_id_container_class = items_id_container_class|merge(['form-field row mb-2']) %}
{% if container.fields['type'] == 'tab' %}
{% set items_id_container_class = items_id_container_class|merge(['col-sm-6']) %}
{% endif %}
{% endif %}
<div class='{{ items_id_container_class|join(' ') }}'>
{% set items_id_dropdown %}
{% do call('Ajax::updateItemOnSelectEvent',
[
'dropdown_' ~ itemtype_input_name ~ rand,
Expand All @@ -186,29 +172,27 @@
}
]) %}

{% if item is not instanceof('Glpi\\Form\\Form') %}
{# fake label for DOM disposition #}
<label class="col-form-label col-xxl-4 text-xxl-end" for="dropdown_items_id_testfield{{ rand }}">
</label>

<div class="col-xxl-8 field-container">
{% endif %}
<span id='results_items_id{{ rand }}' class='col-lg-14'>
{% if value.itemtype|default('') != '' %}
{{ macros.dropdownField(value.itemtype, items_id_input_name, value.items_id|default(''), ' ', field_options|merge({
'entity': value.itemtype|default('') == 'User' ? -1 : item.getEntityID(),
'rand': rand,
'right': 'all',
'displaywith': ['otherserial', 'serial'],
'display_emptychoice' : false,
'no_label': true
})) }}
{% endif %}
</span>
{% if item is not instanceof('Glpi\\Form\\Form') %}
</div>
<span id='results_items_id{{ rand }}' class='col-lg-14'>
{% if value.itemtype|default('') != '' %}
{{ macros.dropdownField(value.itemtype, items_id_input_name, value.items_id|default(''), ' ', field_options|merge({
'entity': value.itemtype|default('') == 'User' ? -1 : item.getEntityID(),
'rand': rand,
'right': 'all',
'displaywith': ['otherserial', 'serial'],
'display_emptychoice' : false,
'no_label': true,
'full_width': true,
})) }}
{% endif %}
</div>
</span>
{% endset %}

{{ macros.dropdownArrayField(itemtype_input_name, value.itemtype|default(''), field['allowed_values'], label, field_options|merge({
'rand' : rand,
'display_emptychoice': true,
'add_field_class' : field_options.add_field_class|default('') ~ ' glpi-fields-plugin-glpi-item-field',
'add_field_html' : items_id_dropdown
})) }}
{% endif %}
{% endif %}
{% endfor %}
Expand Down