From 2f4e9a6ce472744660bb42ebcbebdab991805cde Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Sun, 24 Apr 2016 20:39:11 -0400 Subject: [PATCH] [PASSED QA] 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 --- .../intranet-tmpl/prog/en/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/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css index a638129..455a085 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -2860,3 +2860,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 e314fa1..bdfe0b3 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).attr('checked', 'checked'); - itemSelectionBuildActionLinks(div); - } - - function clearAllItems(div) { - $("input[name='itemnumber'][type='checkbox']", div).removeAttr('checked'); - 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 %] -- 1.9.1
Host recordsUsed inCourse ReservesEdit 
+ [% UNLESS item.cannot_be_edited %] - Edit + Edit [% END %]