From 5c1691a8013bd38d6bae8b00a8950e1417695176 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 21 Feb 2014 15:27:41 -0500 Subject: [PATCH] Bug 11821: disable catalog edit menu items and provide explanations when actions cannot be done Biblio edit menu items which are disabled should trigger a tooltip on hover and an alert on click with explanations. This patch implements this for the relevent menu items. To test, apply the patch for Bug 11829 if necessary. Find a record which has no items attached. Test the following views: - Normal - MARC - Labeled MARC - ISBD - Items Test these Edit menu items: - Edit items in a batch - Delete items in a batch - Delete all items Hovering over these menu items should trigger an explanatory tooltip. Clicking the menu items should trigger a similar alert. Next, locate a title with items attached. On the same pages above, test the Edit -> Delete record menu item. Hovering should trigger an explanatory tooltip. Clicking it should trigger a similar alert. Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer Passes all tests and QA script, works nicely. Signed-off-by: Galen Charlton --- .../prog/en/includes/cat-toolbar.inc | 42 +++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc index e2271df2b5..12a4ad0c2f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -82,10 +82,13 @@ return false; } } else { - alert(_("This record has no items.")); + alertNoItems(); return false; } } + function alertNoItems(){ + alert(_("This record has no items.")); + } [% END %] $(document).ready(function() { $("#z3950copy").click(function(){ @@ -115,6 +118,13 @@ return false; }); $("#export").remove(); // Hide embedded export form if JS menus available + $("#deletebiblio").tooltip(); + $("#batchedit-disabled,#batchdelete-disabled,#deleteallitems-disabled") + .on("click",function(e){ + e.preventDefault(); + alertNoItems(); + }) + .tooltip(); }); //]]> @@ -161,9 +171,21 @@ CAN_user_serials_create_subscription ) %]
  • Edit items
  • [% END %] - [% IF ( CAN_user_tools_items_batchmod ) %]
  • Edit items in batch
  • [% END %] + [% IF ( CAN_user_tools_items_batchmod ) %] + [% IF ( count ) %] +
  • Edit items in batch
  • + [% ELSE %] +
  • Edit items in batch
  • + [% END %] + [% END %] - [% IF ( CAN_user_tools_items_batchdel ) %]
  • Delete items in a batch
  • [% END %] + [% IF ( CAN_user_tools_items_batchdel ) %] + [% IF ( count ) %] +
  • Delete items in a batch
  • + [% ELSE %] +
  • Delete items in a batch
  • + [% END %] + [% END %] [% IF ( CAN_user_editcatalogue_edit_items ) %]
  • Attach item
  • [% END %] @@ -174,13 +196,19 @@ CAN_user_serials_create_subscription ) %]
  • Edit as new (duplicate)
  • Replace record via Z39.50
  • - [% IF ( count ) %]
  • [% ELSE %]
  • [% END %] - Delete record
  • + [% IF ( count ) %] +
  • Delete record
  • + [% ELSE %] +
  • Delete record
  • + [% END %] [% END %] [% IF ( CAN_user_editcatalogue_edit_items ) %] - [% UNLESS ( count ) %]
  • [% ELSE %]
  • [% END %]
  • - Delete all items
  • + [% IF ( count ) %] +
  • Delete all items
  • + [% ELSE %] +
  • Delete all items
  • + [% END %] [% END %] -- 2.39.5