glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
4.16k stars 1.28k forks source link

Allow content to be inserted after inputs labels #17352

Closed AdrienClairembault closed 3 months ago

AdrienClairembault commented 3 months ago

Allow arbitrary HTML content to be inserted after inputs labels in our forms (only for the "vertical field" layout).

For example:

{% set content %}
    <div class='ms-auto'>test</div>
{% endset %}

{{ fields.textField(
    input_name,
    value,
    label,
    {
        insert_content_after_label: content
    },
) }}

image

For extra context, this is needed for a new helpdesk forms related feature that I'm working on this week.

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
cconard96 commented 3 months ago

How does this look when the screen width is larger and the fields have the labels horizontally aligned? I guess ms-auto won't work as expected at least.

AdrienClairembault commented 3 months ago

How does this look when the screen width is larger and the fields have the labels horizontally aligned? I guess ms-auto won't work as expected at least.

This is a "vertical field" in this case so the layout doesn't change with screen width. I had enabled the option for "horizontal field" too but it doesn't work really well on them so I'll disable it for now (I don't need them anyway).

cconard96 commented 3 months ago

I don't know the exact intention with the Forms feature, but if it will allow a field description in addition to a field name:

AdrienClairembault commented 3 months ago

This is not for a description.

AdrienClairembault commented 3 months ago

Had to fix some unrelated E2E test as its selectors were too brittle.

Adding the proper selectors required some changes to the actors field as the for attribute of the label didn't match the id of the select:

image

Should be all good now for reviews.