Bug 35239: (follow-up) Correct more missing label inconsistencies

This patch corrects a couple more labels and modifies the process of
cloning a patron attribute field so that each new cloned row has
matching label and input.

To test, apply the patch and, if necessary, create some patron attribute
types:

- Go to Administration -> Patron attribute types
- Create at least two new patron attribute types.
- Go to Tools -> Batch patron modification.
- Submit a batch of patrons for batch modification
- In the list of fields to modify, test that clicking each label gives
  focus to the corresponding field (except date fields, we need to fix
  that globally).
- Click "New" next to the patron attribute field.
  - A copy of the field should be created. Test that the new field also
    has matching label and <select>

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit ca51e5d642)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2024-07-26 18:17:11 +00:00 committed by Lucas Gass
parent dba73d1cdb
commit 4b1ebe2a5b
1 changed files with 7 additions and 3 deletions

View File

@ -370,7 +370,7 @@
[% END %]
[% IF ( field.type == 'select' ) %]
[% IF field.option.size %]
<select name="[% field.name | html %]" >
<select id="[%field.name | html %]" name="[% field.name | html %]" >
[% FOREACH opt IN field.option %]
<option value="[% opt.value | html %]">[% opt.lib | html %]</option>
[% END %]
@ -393,10 +393,10 @@
[% END %]
[% IF ( patron_attributes_codes ) %]
<li class="attributes">
<label style="width:auto;">
<label for="patron_attributes" style="width:auto;">
<span>Patron attribute:</span>
</label>
<select name="patron_attributes">
<select id="patron_attributes" name="patron_attributes">
<option value=""></option>
[% FOREACH pac IN patron_attributes_codes %]
<option value="[% pac.attribute_code | html %]" data-type="[% pac.type | html %]" data-category="[% pac.category_lib | html %]">[% pac.attribute_lib | html %]</option>
@ -571,12 +571,16 @@
}
function add_attributes() {
var count = $("li.attributes").length;
var li_node = $("li.attributes:last");
var li_clone = $(li_node).clone();
if ( $(li_clone).find("a.del_attributes").length == 0 ) {
var add_attributes = $(li_clone).find("a.add_attributes")
$(add_attributes).after('<a href="#" title="' + _("Delete") + '" class="del_attributes"><i class="fa fa-fw fa-trash-can"></i> ' + _("Delete") + '</a>');
}
li_node.find("label").attr("for", li_node.find("label").attr("for") + "_" + count );
li_node.find("input, select").attr("id", li_node.find("select").attr("id") + "_" + count );
$(li_clone).find('select[name="patron_attributes"]').change(function() {
updateAttrValues(this);
} );