Bug 13123 - Duplicate label ids for language and opaclanguages

When enabling or disabling a OPAC language choice clicking the label
triggers the checkbox under the language preference instead. This is
because both <label>s have the same id.

This patch adds a modifier to each label and corresponding id attribute
in order to make them unique.

To test, go to Administration -> System preferences -> I18N/L10N.
Clicking the "English (en)" label under the "language" system preference
should toggle the corresponding checkbox. Clicking the "English (en)"
label under the "opaclanguages" system preference should toggle the
correct checkbox.

Further tests:

- Install an English 'sub-language' like en-GB and confirm that
  checkbox labels work correctly.
- Install a non-English language and confirm that checkbox labels work
  correctly.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, template changes only.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Owen Leonard 2014-10-21 14:31:25 -04:00 committed by Tomas Cohen Arazi
parent f9e3891050
commit 9e977e85c5

View file

@ -128,21 +128,21 @@
</dt>
[% FOREACH sublanguages_loo IN language.sublanguages_loop %]
<dd>
<label for="[% sublanguages_loo.rfc4646_subtag %]">[% sublanguages_loo.native_description %] [% sublanguages_loo.script_description %] [% sublanguages_loo.region_description %] [% sublanguages_loo.variant_description %]([% sublanguages_loo.rfc4646_subtag %])</label>
<label for="pref_[% CHUNK.name %]_[% sublanguages_loo.rfc4646_subtag %]">[% sublanguages_loo.native_description %] [% sublanguages_loo.script_description %] [% sublanguages_loo.region_description %] [% sublanguages_loo.variant_description %]([% sublanguages_loo.rfc4646_subtag %])</label>
[% IF ( sublanguages_loo.enabled ) %]
<input value="[% sublanguages_loo.rfc4646_subtag %]" name="pref_[% CHUNK.name %]" id="[% sublanguages_loo.rfc4646_subtag %]" type="checkbox" checked="checked" class="preference preference-checkbox"/>
<input value="[% sublanguages_loo.rfc4646_subtag %]" name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]_[% sublanguages_loo.rfc4646_subtag %]" type="checkbox" checked="checked" class="preference preference-checkbox"/>
[% ELSE %]
<input value="[% sublanguages_loo.rfc4646_subtag %]" name="pref_[% CHUNK.name %]" id="[% sublanguages_loo.rfc4646_subtag %]" type="checkbox" class="preference preference-checkbox"/>
<input value="[% sublanguages_loo.rfc4646_subtag %]" name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]_[% sublanguages_loo.rfc4646_subtag %]" type="checkbox" class="preference preference-checkbox"/>
[% END %]
</dd>
[% END %]
[% ELSE %]
<dt>
<label for="[% language.rfc4646_subtag %]">[% language.native_description %]([% language.rfc4646_subtag %])</label>
<label for="pref_[% CHUNK.name %]_[% language.rfc4646_subtag %]">[% language.native_description %]([% language.rfc4646_subtag %])</label>
[% IF ( language.group_enabled ) %]
<input value="[% language.rfc4646_subtag %]" name="pref_[% CHUNK.name %]" id="[% language.rfc4646_subtag %]" type="checkbox" checked="checked" class="preference preference-checkbox"/>
<input value="[% language.rfc4646_subtag %]" name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]_[% language.rfc4646_subtag %]" type="checkbox" checked="checked" class="preference preference-checkbox"/>
[% ELSE %]
<input value="[% language.rfc4646_subtag %]" name="pref_[% CHUNK.name %]" id="[% language.rfc4646_subtag %]" type="checkbox" class="preference preference-checkbox"/>
<input value="[% language.rfc4646_subtag %]" name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]_[% language.rfc4646_subtag %]" type="checkbox" class="preference preference-checkbox"/>
[% END %]
</dt>
[% END %]