From f912c4608c1595c8173a20fa9f29193aec5e211f 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 Content-Type: text/plain; charset="utf-8" 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. --- .../opac-tmpl/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 71ba2e7..469141e 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 %] -- 1.7.9.5