From abdcaa3d9e51fcfd797249062e640138a128158c Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 13 Apr 2012 15:21:49 -0400 Subject: [PATCH] Bug 7959 - Update OPAC suggestions interface to match lists Marking up suggestions "toolbar" to match the interface in lists. Actions which require an item to be selected (deleting a suggestion) should not be available if nothing is selected. Signed-off-by: Paul Poulain --- .../prog/en/modules/opac-suggestions.tt | 59 ++++++++++++++----- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt index 71ba2e7737..469141e61e 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt @@ -12,6 +12,17 @@ $.tablesorter.addParser({ format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); }, type: 'text' }); +[% IF ( loggedinusername ) %]function enableCheckboxActions(){ + // Enable/disable controls if checkboxes are checked + var checkedBoxes = $(".checkboxed input:checkbox:checked"); + if ($(checkedBoxes).size()) { + $("#selections").html(_("With selected suggestions: ")); + $("#selections-toolbar .links a").removeClass("disabled"); + } else { + $("#selections").html(_("Select suggestions to: ")); + $("#selections-toolbar .links a").addClass("disabled"); + } +}[% END %] $(function() { $("#suggestt").tablesorter({ @@ -32,17 +43,29 @@ $.tablesorter.addParser({ [% END %] [% END %] } - }); - $("#CheckAll").click(function(){ - $(".checkboxed").checkCheckboxes(); - return false; - }); - $("#CheckNone").click(function(){ - $(".checkboxed").unCheckCheckboxes(); - return false; - }); + }); + [% IF ( loggedinusername ) %]$("span.clearall").html(""+_('Clear all')+"<\/a>"); + $("span.checkall").html(""+_('Select all')+"<\/a>"); + $("#CheckAll").click(function(){ + $(".checkboxed").checkCheckboxes(); + enableCheckboxActions(); + return false; + }); + $("#CheckNone").click(function(){ + $(".checkboxed").unCheckCheckboxes(); + enableCheckboxActions(); + return false; + }); + $(".cb").click(function(){ + enableCheckboxActions(); + }); + $("#removeitems").html(""+_("Delete")+"") + .click(function(){ + $("#myform").submit(); + return false; + });[% END %] }); - + function Check(f) { var _alertString=""; var alertString2; @@ -115,7 +138,7 @@ $.tablesorter.addParser({ [% END %] [% IF ( op_else ) %] -

[% UNLESS ( OPACViewOthersSuggestions ) %][% IF ( loggedinusername ) %]My [% END %][% END %]Purchase suggestions

+

[% IF ( OPACViewOthersSuggestions ) %]Purchase suggestions[% ELSE %][% IF ( loggedinusername ) %]My purchase suggestions[% ELSE %]Purchase suggestions[% END %][% END %]

[% IF ( deleted ) %]
The selected suggestions have been deleted.
[% END %] [% IF ( submitted ) %]
Your suggestion has been submitted.
[% END %] @@ -146,11 +169,15 @@ $.tablesorter.addParser({ [% END %] -
+ -
Select all - Clear all | [% IF ( loggedinusername ) %]New purchase suggestion[% ELSE %][% IF ( AnonSuggestions ) %]New purchase suggestion[% END %][% END %] +
[% IF ( loggedinusername ) %]New purchase suggestion[% ELSE %][% IF ( AnonSuggestions ) %]New purchase suggestion[% END %][% END %]
+ [% IF ( loggedinusername ) %]
+ | + Select suggestions to: + +
[% END %] [% IF ( loggedinusername ) %][% END %] @@ -164,7 +191,7 @@ $.tablesorter.addParser({ [% IF ( suggestions_loo.even ) %][% ELSE %][% END %] [% IF ( loggedinusername ) %][% END %]
 
[% IF ( suggestions_loo.showcheckbox ) %] - + [% END %] @@ -199,7 +226,7 @@ $.tablesorter.addParser({ [% END %]
[% IF ( loggedinusername ) %]
- +
[% END %] -- 2.39.5