Bug 41838: Fix automatic tab selection on MARC subfield edit pages
This patch fixes automatic tab selection on MARC subfield edit pages for both authority and bibliographic records. The patch also removes some unused markup and JS associated with old ways of handling tabs. To test, apply the patch and go to Administration -> Authority types. - Click the "Actions" button for one of the authority types and select "MARC structure" - Pick a tag which has multiple subfields, e.g. 020 and click Actions -> Subfields. - Click one of the subfield links (not the first one). On the subfield edit page the corresponding tab should be selected when the page loads. - Go back and click the "Edit" button and confirm that this also selects the correct tab. - Go to Administration -> MARC bibliographic framework -> MARC structure -> View subfields and perform the same tests. Sponsored-by: Athens County Public Libraries Signed-off-by: John Doe <you@example.com> Signed-off-by: Nic Olsson <olsson.nic@gmail.com> Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
This commit is contained in:
parent
e4be46c2c5
commit
239d31a57f
|
|
@ -361,7 +361,9 @@
|
|||
[% FOREACH loo IN loop %]
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/cgi-bin/koha/admin/auth_subfields_structure.pl?op=add_form&tagfield=[% tagfield | uri %]&authtypecode=[% authtypecode | uri %]#sub[% subfieldanchor | uri %]field">[% loo.tagsubfield | html %]</a>
|
||||
<a href="/cgi-bin/koha/admin/auth_subfields_structure.pl?op=add_form&tagfield=[% tagfield | uri %]&authtypecode=[% authtypecode | uri %]&tagsubfield=[% loo.tagsubfield | uri %]"
|
||||
>[% loo.tagsubfield | html %]</a
|
||||
>
|
||||
</td>
|
||||
<td>
|
||||
[% IF loo.tab == -1 %]
|
||||
|
|
@ -401,9 +403,7 @@
|
|||
[% END %]
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a
|
||||
href="/cgi-bin/koha/admin/auth_subfields_structure.pl?op=add_form&tagfield=[% tagfield | uri %]&tagsubfield=[% loo.tagsubfield | uri %]&authtypecode=[% authtypecode | uri %]#sub[% loo.tagsubfield | uri %]field"
|
||||
class="btn btn-default btn-xs"
|
||||
<a href="/cgi-bin/koha/admin/auth_subfields_structure.pl?op=add_form&tagfield=[% tagfield | uri %]&tagsubfield=[% loo.tagsubfield | uri %]&authtypecode=[% authtypecode | uri %]" class="btn btn-default btn-xs"
|
||||
><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a
|
||||
>
|
||||
<a
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@
|
|||
[% FOREACH loo IN loop %]
|
||||
<tr>
|
||||
<td
|
||||
><a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&tagfield=[% loo.tagfield | uri %]&frameworkcode=[% frameworkcode | uri %]#sub[% loo.tagsubfield | uri %]field"
|
||||
><a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&tagfield=[% loo.tagfield | uri %]&frameworkcode=[% frameworkcode | uri %]&tagsubfield=[% loo.tagsubfield | uri %]"
|
||||
>[% loo.tagsubfield | html %]</a
|
||||
></td
|
||||
>
|
||||
|
|
@ -405,7 +405,7 @@
|
|||
</td>
|
||||
<td class="actions">
|
||||
<a
|
||||
href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&tagfield=[% loo.tagfield | uri %]&tagsubfield=[% loo.tagsubfield | uri %]&frameworkcode=[% frameworkcode | uri %]#sub[% loo.tagsubfield | uri %]field"
|
||||
href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&tagfield=[% loo.tagfield | uri %]&tagsubfield=[% loo.tagsubfield | uri %]&frameworkcode=[% frameworkcode | uri %]"
|
||||
class="btn btn-default btn-xs"
|
||||
><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a
|
||||
>
|
||||
|
|
@ -439,7 +439,7 @@
|
|||
[% Asset.js( "lib/sortable/Sortable.min.js" ) | $raw %]
|
||||
[% Asset.js("js/admin-menu.js") | $raw %]
|
||||
<script>
|
||||
var tagsubfield = "[% tagsubfield | html %]";
|
||||
const tagsubfield = [% IF tagsubfield %]"[% tagsubfield | html %]"[% ELSE %]null[% END %];
|
||||
</script>
|
||||
[% Asset.js("js/marc_subfields_structure.js") | $raw %]
|
||||
[% END %]
|
||||
|
|
|
|||
|
|
@ -1,29 +1,31 @@
|
|||
/* global tagsubfield selectBsTabByHash */
|
||||
/* global tagsubfield */
|
||||
$(document).ready(function () {
|
||||
if (tagsubfield && tagsubfield == "@") {
|
||||
$("#subfieldtabs a[href='#AT_panel']").tab("show");
|
||||
} else if (tagsubfield && tagsubfield != "@") {
|
||||
$("#subfieldtabs a[href='#" + tagsubfield + "_panel'").tab("show");
|
||||
} else {
|
||||
$("#subfieldtabs a:first").tab("show");
|
||||
}
|
||||
if ($("#subfieldtabs").length > 0) {
|
||||
if (tagsubfield && tagsubfield == "@") {
|
||||
$("#subfieldtabs a[href='#AT_panel']").tab("show");
|
||||
} else if (tagsubfield && tagsubfield != "@") {
|
||||
$(`#subfieldtabs a[href='#${tagsubfield}_panel']`).tab("show");
|
||||
} else {
|
||||
$("#subfieldtabs a:first").tab("show");
|
||||
}
|
||||
|
||||
var subfields_list = $("#subfieldtabs > ul");
|
||||
var sortable_subfields = new Sortable(subfields_list[0], {
|
||||
onEnd: function (e) {
|
||||
var old_index = e.oldIndex;
|
||||
var new_index = e.newIndex;
|
||||
if (old_index < new_index) new_index++;
|
||||
var subfield_code = e.item.id.replace(/^tab_subfield_/, "");
|
||||
var content = $("#" + subfield_code + "_panel");
|
||||
var panels = $("#subfieldtabs .tab-pane");
|
||||
if (new_index < $(panels).size()) {
|
||||
$(content).insertBefore(panels[new_index]);
|
||||
} else {
|
||||
$(content).insertAfter(panels[new_index - 1]);
|
||||
}
|
||||
},
|
||||
});
|
||||
var subfields_list = $("#subfieldtabs > ul");
|
||||
var sortable_subfields = new Sortable(subfields_list[0], {
|
||||
onEnd: function (e) {
|
||||
var old_index = e.oldIndex;
|
||||
var new_index = e.newIndex;
|
||||
if (old_index < new_index) new_index++;
|
||||
var subfield_code = e.item.id.replace(/^tab_subfield_/, "");
|
||||
var content = $("#" + subfield_code + "_panel");
|
||||
var panels = $("#subfieldtabs .tab-pane");
|
||||
if (new_index < $(panels).size()) {
|
||||
$(content).insertBefore(panels[new_index]);
|
||||
} else {
|
||||
$(content).insertAfter(panels[new_index - 1]);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
$("input[id^='hidden_']").click(setHiddenValue);
|
||||
$("input[id^='hidden-']").each(function () {
|
||||
|
|
@ -33,8 +35,6 @@ $(document).ready(function () {
|
|||
order: [],
|
||||
paging: false,
|
||||
});
|
||||
|
||||
selectBsTabByHash("subfieldtabs");
|
||||
});
|
||||
|
||||
/* Function to enable/disable hidden values checkboxes when Flag is (de)selected */
|
||||
|
|
|
|||
Loading…
Reference in New Issue