Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix display of fields with full_width enabled #17916

Merged
merged 3 commits into from
Sep 30, 2024
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 @@ -86,6 +86,7 @@ The present file will list all changes made to the project; according to the
- `status.php` and `bin/console system:status` no longer supports plain-text output.
- `Glpi\System\Status\StatusChecker::getServiceStatus()` `as_array` parameter.
- `Sylk` export of search results.
- `full_width_adapt_column` option for fields macros has been removed.

### API changes

Expand Down
10 changes: 10 additions & 0 deletions css/includes/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,16 @@ body pre {
color: var(--tblr-body-color);
}

.col-12.glpi-full-width {
.col-form-label {
width: calc(-4px + 20.8333%);
}

.field-container {
width: calc(-11px + 79.1666%);
}
}

// Needed as 'text-muted' may not always be readable depending on the menu
// background color.
.horizontal-layout {
Expand Down
10 changes: 1 addition & 9 deletions templates/components/form/fields_macros.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,6 @@
{% macro horizontalField(label, field, id, add_field_html = '', options = {}) %}
{% set options = {
'full_width': false,
'full_width_adapt_column': true,
'align_label_right': true,
'mb': 'mb-2',
'field_class': 'col-12 col-sm-6',
Expand All @@ -832,15 +831,8 @@

{% if options.full_width %}
{% set options = options|merge({
field_class: 'col-12',
field_class: 'col-12 glpi-full-width',
}) %}

{% if options.full_width_adapt_column %}
{% set options = {
label_class: 'col-xxl-4',
input_class: 'col-xxl-8',
}|merge(options) %}
{% endif %}
{% endif %}

{% set options = {
Expand Down
1 change: 0 additions & 1 deletion templates/components/itilobject/itilsatisfaction.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
__('Satisfaction with the resolution of the %s')|format(parent_item.getTypeName(1)),
{
'full_width': true,
'full_width_adapt_column': false,
'label_class': 'col-xxl-4',
'input_class': 'col-xxl-8 text-start',
}
Expand Down
1 change: 0 additions & 1 deletion templates/components/itilobject/selfservice.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
{% set base_field_options = {
'is_horizontal': false,
'full_width': true,
'full_width_adapt_column': false,
'fields_template': itiltemplate,
'rand': rand,
} %}
Expand Down
1 change: 0 additions & 1 deletion templates/components/notepad/form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

{% set fields_options = {
full_width: true,
full_width_adapt_column: false,
is_horizontal: false,
} %}

Expand Down
2 changes: 0 additions & 2 deletions templates/components/search/query_builder/criteria.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
{{ fields.dropdownArrayField("criteria" ~ prefix ~ "[" ~ num ~ "][link]", value, operators, '', {
full_width: true,
input_class: 'col-12',
full_width_adapt_column: false,
no_label: true,
mb: 'mb-0',
}) }}
Expand All @@ -90,7 +89,6 @@
rand: rand,
full_width: true,
input_class: 'col-12',
full_width_adapt_column: false,
no_label: true,
mb: 'mb-0',
}) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
{{ fields.dropdownArrayField("criteria" ~ prefix ~ "[" ~ num ~ "][link]", criteria["link"] ?? '', call('\\Glpi\\Search\\SearchEngine::getLogicalOperators'), '', {
full_width: true,
input_class: 'col-12',
full_width_adapt_column: false,
mb: 'mb-0',
no_label: true,
}) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
{{ fields.dropdownArrayField(dropdown_name, dropdown_value, call('Glpi\\Search\\SearchEngine::getLogicalOperators'), '', {
full_width: true,
input_class: 'col-12',
full_width_adapt_column: false,
no_label: true,
mb: 'mb-0',
}) }}
Expand All @@ -61,7 +60,6 @@
rand: rand,
full_width: true,
input_class: 'col-12',
full_width_adapt_column: false,
no_label: true,
mb: 'mb-0',
}) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
rand: rand,
full_width: true,
input_class: 'col-12',
full_width_adapt_column: false,
no_label: true,
mb: 'mb-0',
}) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
rand: rand,
full_width: true,
input_class: 'col-12',
full_width_adapt_column: false,
no_label: true,
mb: 'mb-0',
} %}
Expand Down
1 change: 0 additions & 1 deletion templates/dropdown_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
field['label'],
{
full_width: true,
full_width_adapt_column: false,
is_horizontal: false,
enable_richtext: field['enable_richtext'] is defined ? field['enable_richtext'] : true,
}
Expand Down
1 change: 0 additions & 1 deletion templates/pages/assets/cable.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
{% set rand_side = random() %}
{% set side_options = field_options|merge({
'full_width': true,
'full_width_adapt_column': false,
'rand': rand_side,
}) %}
{% set html_side %}
Expand Down
17 changes: 2 additions & 15 deletions templates/pages/setup/notification/translation.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@
{% set template_link %}
<a href="{{ 'NotificationTemplate'|itemtype_form_path ~ '?id=' ~ template.fields['id'] }}">{{ template.fields['name'] }}</a>
{% endset %}
{{ fields.htmlField('', template_link, 'NotificationTemplate'|itemtype_name(1), {
full_width_adapt_column: false,
label_class: 'col-xxl-4'
}) }}
{{ fields.htmlField('', template_link, 'NotificationTemplate'|itemtype_name(1)) }}

{% do call('Ajax::createIframeModalWindow', ['tags' ~ rand, path('/front/notification.tags.php?sub_type=') ~ template.fields['itemtype']]) %}
{% set show_tags %}
Expand All @@ -60,16 +57,12 @@
emptylabel: __('Default translation'),
display: false
}]), __('Language'), {
full_width_adapt_column: false,
label_class: 'col-xxl-4'
full_width: true,
}) }}

{{ fields.nullField() }}
{{ fields.textField('subject', item.fields['subject'], __('Subject'), {
full_width: true,
full_width_adapt_column: false,
label_class: 'col-xxl-2',
input_class: 'col-xxl-10'
}) }}

{% set text_content_label %}
Expand All @@ -79,17 +72,11 @@
{% endset %}
{{ fields.textareaField('content_text', item.fields['content_text'], text_content_label, {
full_width: true,
full_width_adapt_column: false,
label_class: 'col-xxl-2',
input_class: 'col-xxl-10',
rows: 15
}) }}

{{ fields.textareaField('content_html', item.fields['content_html']|safe_html, __('Email HTML body'), {
full_width: true,
full_width_adapt_column: false,
label_class: 'col-xxl-2',
input_class: 'col-xxl-10',
rows: 15,
enable_richtext: true,
id: 'content' ~ rand
Expand Down
5 changes: 0 additions & 5 deletions templates/pages/tools/reminder.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@

{{ fields.textField('name', item.fields['name'], __('Title'), field_options|merge({
full_width: true,
full_width_adapt_column: false
})) }}

{% if params['from_planning_ajax'] is not defined %}
Expand All @@ -69,7 +68,6 @@
{% endset %}
{{ fields.htmlField('', visibility_fields, __('Visibility'), field_options|merge({
full_width: true,
full_width_adapt_column: false,
wrapper_class: 'd-flex',
})) }}
{% endif %}
Expand All @@ -83,7 +81,6 @@
{% endset %}
{{ fields.htmlField('', state_dropdown, __('Status'), field_options|merge({
full_width: true,
full_width_adapt_column: false,
})) }}

{% set calendar_field %}
Expand Down Expand Up @@ -146,12 +143,10 @@
{% endset %}
{{ fields.htmlField('', calendar_field, _n('Calendar', 'Calendars', 1), field_options|merge({
full_width: true,
full_width_adapt_column: false,
})) }}

{{ fields.textareaField('text', item.fields['text']|safe_html, __('Description'), field_options|merge({
full_width: true,
full_width_adapt_column: false,
enable_richtext: true,
enable_fileupload: true,
})) }}
Expand Down
Loading