Bug 35144

Summary: 'Required' mention for patron attributes is not red in OPAC
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: minor    
Priority: P5 - low CC: fridolin.somers, lucas, m.de.rooy, philippe.blouin
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.06,22.11.12
Circulation function:
Attachments: Bug 35144: Update style of 'Required' label for OPAC patron attributes
Bug 35144: Update style of 'Required' label for OPAC patron attributes
Bug 35144: Update style of 'Required' label for OPAC patron attributes
Bug 35144: Update style of 'Required' label for OPAC patron attributes

Description Caroline Cyr La Rose 2023-10-24 16:18:15 UTC
If we make a patron attribute mandatory, the 'Required' flag is displayed in the OPAC, but not in red. It is also misaligned.

To recreate:
1. Create a mandatory patron attribute editable in OPAC
   1.1. Go to Administration > Patron attribute types > New patron attribute type
   1.2. Fill out the form
        - Code: enter any code
        - Description: enter any description
        - Display in OPAC: check
        - Editable in OPAC: check
        - Mandatory: check
   1.3. Click Save

2. Enable self-registration
   2.1. Go to Administration > System preferences
   2.2. Search for selfreg
   2.3. Set PatronSelfRegistration to Allow
   2.4. Set a category in PatronSelfRegistrationDefaultCategory
   2.5. Click Save all OPAC preferences

3. View self-registration form
   3.1. Go to the OPAC
   3.2. Click on Don't have an account? Register here.
   3.3. Go to the bottom of the form
        --> Note that the 'Required' flag is to the left of the field and it is not red
        --> You can compare with surname, firstname, or the verification field
Comment 1 Caroline Cyr La Rose 2023-10-30 15:41:11 UTC
I noticed that if the attribute is a text field, the "Required" flag is aligned on the left. But if the attribute is a drop-down, the "Required" flag is correctly aligned with the field.
Comment 2 Owen Leonard 2023-11-08 16:41:29 UTC
Created attachment 158665 [details] [review]
Bug 35144: Update style of 'Required' label for OPAC patron attributes

This patch makes some changes to style and markup of the part of the
OPAC patron entry form which displays patron attribute entry fields.

To test, apply the patch and rebuild the OPAC CSS.

- Create at least two patron attributes which have both "Display in
  OPAC" and "Editable in OPAC" checked: One which is linked to an
  authorized value, one which isn't. At least one attribute should be
  mandatory. At least one attribute should be repeatable.
- Test the form using either patron self-registration or by logging in
  to the OPAC and clicking the "Personal details" link in the sidebar.
- Check the appearance of required fields in the form, including the
  mandatory patron attributes.
- Confirm that the "Clear" and "New" controls look good and work
  correctly, including fields cloned with the "New" button.
Comment 3 Lucas Gass (lukeg) 2023-11-08 17:18:24 UTC
Is chaining "parent().parent()" better than something like "closest('.row')" ? 

Just curious as I tend to avoid that kind of chaining as it seems closest() is less likely to break. For example, if another HTML element is added, say around the fieldset.
Comment 4 Owen Leonard 2023-11-08 19:37:24 UTC
Created attachment 158670 [details] [review]
Bug 35144: Update style of 'Required' label for OPAC patron attributes

This patch makes some changes to style and markup of the part of the
OPAC patron entry form which displays patron attribute entry fields.

To test, apply the patch and rebuild the OPAC CSS.

- Create at least two patron attributes which have both "Display in
  OPAC" and "Editable in OPAC" checked: One which is linked to an
  authorized value, one which isn't. At least one attribute should be
  mandatory. At least one attribute should be repeatable.
- Test the form using either patron self-registration or by logging in
  to the OPAC and clicking the "Personal details" link in the sidebar.
- Check the appearance of required fields in the form, including the
  mandatory patron attributes.
- Confirm that the "Clear" and "New" controls look good and work
  correctly, including fields cloned with the "New" button.
Comment 5 Owen Leonard 2023-11-08 19:38:36 UTC
> Is chaining "parent().parent()" better than something like "closest('.row')"

Looks like strictly speaking parent() is every so slightly faster, but not enough to outweigh the improved maintainability of the code!
Comment 6 Lucas Gass (lukeg) 2023-11-08 20:43:23 UTC
Created attachment 158673 [details] [review]
Bug 35144: Update style of 'Required' label for OPAC patron attributes

This patch makes some changes to style and markup of the part of the
OPAC patron entry form which displays patron attribute entry fields.

To test, apply the patch and rebuild the OPAC CSS.

- Create at least two patron attributes which have both "Display in
  OPAC" and "Editable in OPAC" checked: One which is linked to an
  authorized value, one which isn't. At least one attribute should be
  mandatory. At least one attribute should be repeatable.
- Test the form using either patron self-registration or by logging in
  to the OPAC and clicking the "Personal details" link in the sidebar.
- Check the appearance of required fields in the form, including the
  mandatory patron attributes.
- Confirm that the "Clear" and "New" controls look good and work
  correctly, including fields cloned with the "New" button.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 7 Marcel de Rooy 2023-11-10 10:37:35 UTC
Created attachment 158797 [details] [review]
Bug 35144: Update style of 'Required' label for OPAC patron attributes

This patch makes some changes to style and markup of the part of the
OPAC patron entry form which displays patron attribute entry fields.

To test, apply the patch and rebuild the OPAC CSS.

- Create at least two patron attributes which have both "Display in
  OPAC" and "Editable in OPAC" checked: One which is linked to an
  authorized value, one which isn't. At least one attribute should be
  mandatory. At least one attribute should be repeatable.
- Test the form using either patron self-registration or by logging in
  to the OPAC and clicking the "Personal details" link in the sidebar.
- Check the appearance of required fields in the form, including the
  mandatory patron attributes.
- Confirm that the "Clear" and "New" controls look good and work
  correctly, including fields cloned with the "New" button.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Tomás Cohen Arazi (tcohen) 2023-11-10 14:02:33 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 9 Fridolin Somers 2023-11-11 08:01:50 UTC
Pushed to 23.05.x for 23.05.06
Comment 10 Pedro Amorim 2023-11-14 15:02:11 UTC
Nice work everyone!

Pushed to 22.11.x for next release