From a0f52f8bbcf0a7aab69788a1389b3b23d1c51693 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Sun, 24 Apr 2016 20:39:11 -0400 Subject: [PATCH] Bug 16341: Revise the way table controls look on the title detail page This patch makes changes to the way links are displayed on the bibliographic detail page, adding Font Awesome icons to make the links clearer. Some instances of the "onclick" attribute are removed. This patch also converts the "Edit" link to a Bootstrap button. To test, apply the patch and locate a title in the catalog with multiple holdings from different branches. Test all the table controls under a variety of conditions: - Logged in as a user who can or can't edit items - Logged in as a user who can or can't perform batch item operations. - With the StaffDetailItemSelection system preference enabled or disabled. - With the SeparateHoldings system preference turned on or off. Signed-off-by: Hector Castro Works as advertised. Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall --- .../intranet-tmpl/prog/css/staff-global.css | 4 + .../prog/en/modules/catalogue/detail.tt | 81 ++++++++++--------- 2 files changed, 48 insertions(+), 37 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/css/staff-global.css index 722f2be977..35fa6f8d94 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/css/staff-global.css @@ -2718,3 +2718,7 @@ div.duration h5, div.blocks h5 { div.duration span, div.blocks div { display:block; } + +div[class$="_table_controls"] { + padding: .7em 0; +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index f7ed7c3c9c..a1e4efba10 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -94,15 +94,6 @@ function verify_images() { } [% IF StaffDetailItemSelection %] - function selectAllItems(div) { - $("input[name='itemnumber'][type='checkbox']", div).prop('checked', true); - itemSelectionBuildActionLinks(div); - } - - function clearAllItems(div) { - $("input[name='itemnumber'][type='checkbox']", div).prop('checked', false); - itemSelectionBuildActionLinks(div); - } function itemSelectionBuildDeleteLink(div) { var itemnumbers = new Array(); @@ -114,9 +105,7 @@ function verify_images() { url += '&itemnumber=' + itemnumbers.join('&itemnumber='); url += '&src=' + '[% "/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber" |uri %]'; $('a.itemselection_action_delete').attr('href', url); - $('a.itemselection_action_delete').show(); } else { - $('a.itemselection_action_delete').hide(); return false; } return true @@ -132,15 +121,14 @@ function verify_images() { url += '&itemnumber=' + itemnumbers.join('&itemnumber='); url += '&src=' + '[% "/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber" |uri %]'; $('a.itemselection_action_modify').attr('href', url); - $('a.itemselection_action_modify').show(); } else { - $('a.itemselection_action_modify').hide(); return false; } return true; } - function itemSelectionBuildActionLinks(div) { + function itemSelectionBuildActionLinks(tab) { + var div = $("#" + tab); var delete_link_ok = itemSelectionBuildDeleteLink(div); var modify_link_ok = itemSelectionBuildModifyLink(div); if (modify_link_ok || delete_link_ok) { @@ -151,14 +139,31 @@ function verify_images() { } $(document).ready(function() { + $('table.items_table').each(function() { - var div = $(this).parent().parent(); + var div = $(this).parent().attr("id"); itemSelectionBuildActionLinks(div); }); + $("input[name='itemnumber'][type='checkbox']").change(function() { - var div = $(this).parents('table').parent().parent(); + var div = $(this).parents('table').parent().parent().attr("id"); itemSelectionBuildActionLinks(div); }); + + $(".SelectAll").on("click",function(e){ + e.preventDefault(); + var tab = $(this).data("tab"); + $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', true); + itemSelectionBuildActionLinks(tab); + }); + + $(".ClearAll").on("click",function(e){ + e.preventDefault(); + var tab = $(this).data("tab"); + $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', false); + itemSelectionBuildActionLinks(tab); + }); + }); [% END %] @@ -236,7 +241,7 @@ function verify_images() { } $('#' + id + '_activate_filters') - .text(_("Deactivate filters")) + .html(' ' + _("Deactivate filters") ) .unbind('click') .click(function() { deactivate_filters(id); @@ -254,7 +259,7 @@ function verify_images() { filters_row.hide(); $('#' + id + '_activate_filters') - .text(_("Activate filters")) + .html(' ' + _("Activate filters") ) .unbind('click') .click(function() { activate_filters(id); @@ -288,7 +293,7 @@ function verify_images() { link = $('') .attr('href', '#') .attr('id', id + '_activate_filters'); - table.before(link); + $("." + id + "_table_controls").prepend(link); deactivate_filters(id); } [% IF Koha.Preference('AcquisitionDetails') %] @@ -561,19 +566,21 @@ function verify_images() { [% items_table_block_iter = 0 %] [% BLOCK items_table %] [% items_table_block_iter = items_table_block_iter + 1 %] - [% IF (StaffDetailItemSelection) %] - Select all | - Clear all - - | Actions: - [% IF CAN_user_tools_items_batchdel %] - Delete selected items - [% END %] - [% IF CAN_user_tools_items_batchmod %] - Modify selected items - [% END %] - - [% END %] +
+ [% IF (StaffDetailItemSelection) %] + | Select all | + Clear all + + | Actions: + [% IF CAN_user_tools_items_batchdel %] + Delete selected items + [% END %] + [% IF CAN_user_tools_items_batchmod %] + Modify selected items + [% END %] + + [% END %] +
@@ -597,7 +604,7 @@ function verify_images() { [% IF ( hostrecords ) %][% END %] [% IF ( analyze ) %][% END %] [% IF ( ShowCourseReserves ) %][% END %] - [% IF ( CAN_user_editcatalogue_edit_items ) %][% END %] + [% IF ( CAN_user_editcatalogue_edit_items ) %][% END %] @@ -803,9 +810,9 @@ function verify_images() { [% END %] [% IF CAN_user_editcatalogue_edit_items %] - [% END %] @@ -818,7 +825,7 @@ function verify_images() {
[% IF ( count ) %] [% IF ( showncount ) %] - [% PROCESS items_table items=itemloop %] + [% PROCESS items_table tab="holdings" items=itemloop %] [% END %] [% IF ( hiddencount ) %]

Show all items ([% hiddencount %] hidden) @@ -845,7 +852,7 @@ function verify_images() { [% IF (SeparateHoldings) %]

[% IF (otheritemloop.size) %] - [% PROCESS items_table items=otheritemloop %] + [% PROCESS items_table tab="otherholdings" items=otheritemloop %] [% ELSE %] No other items. [% END %] -- 2.39.5
Host recordsUsed inCourse ReservesEdit 
+ [% UNLESS item.cannot_be_edited %] - Edit + Edit [% END %]