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. --- .../intranet-tmpl/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 e2271df..12a4ad0 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(); }); //]]> </script> @@ -161,9 +171,21 @@ CAN_user_serials_create_subscription ) %] <li><a id="edititems" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]">Edit items</a></li> [% END %] - [% IF ( CAN_user_tools_items_batchmod ) %]<li><a href="/cgi-bin/koha/tools/batchMod.pl?op=show&biblionumber=[% biblionumber %]&src=CATALOGUING">Edit items in batch</a></li>[% END %] + [% IF ( CAN_user_tools_items_batchmod ) %] + [% IF ( count ) %] + <li><a id="batchedit" href="/cgi-bin/koha/tools/batchMod.pl?op=show&biblionumber=[% biblionumber %]&src=CATALOGUING">Edit items in batch</a></li> + [% ELSE %] + <li class="disabled"><a id="batchedit-disabled" href="#" data-toggle="tooltip" data-placement="left" title="This record has no items">Edit items in batch</a></li> + [% END %] + [% END %] - [% IF ( CAN_user_tools_items_batchdel ) %]<li><a href="/cgi-bin/koha/tools/batchMod.pl?del=1&op=show&biblionumber=[% biblionumber %]&src=CATALOGUING">Delete items in a batch</a></li>[% END %] + [% IF ( CAN_user_tools_items_batchdel ) %] + [% IF ( count ) %] + <li><a id="batchdelete" href="/cgi-bin/koha/tools/batchMod.pl?del=1&op=show&biblionumber=[% biblionumber %]&src=CATALOGUING">Delete items in a batch</a></li> + [% ELSE %] + <li class="disabled"><a id="batchdelete-disabled" href="#" data-toggle="tooltip" data-placement="left" title="This record has no items">Delete items in a batch</a></li> + [% END %] + [% END %] [% IF ( CAN_user_editcatalogue_edit_items ) %]<li><a href="/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=[% biblionumber %]">Attach item</a></li>[% END %] @@ -174,13 +196,19 @@ CAN_user_serials_create_subscription ) %] <li><a id="duplicatebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]&frameworkcode=[% current_framework %]&op=duplicate">Edit as new (duplicate)</a></li> <li><a href="#" id="z3950copy">Replace record via Z39.50</a></li> - [% IF ( count ) %]<li class="disabled">[% ELSE %]<li>[% END %] - <a id="deletebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&biblionumber=[% biblionumber %]">Delete record</a></li> + [% IF ( count ) %] + <li class="disabled"><a id="deletebiblio" data-toggle="tooltip" data-placement="left" title="[% count %] item(s) are attached to this record. You must delete all items before deleting this record." href="#">Delete record</a></li> + [% ELSE %] + <li><a id="deletebiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&biblionumber=[% biblionumber %]">Delete record</a></li> + [% END %] [% END %] [% IF ( CAN_user_editcatalogue_edit_items ) %] - [% UNLESS ( count ) %]<li class="disabled">[% ELSE %]<li>[% END %]<li> - <a href="#" id="deleteallitems">Delete all items</a></li> + [% IF ( count ) %] + <li><a href="#" id="deleteallitems">Delete all items</a></li> + [% ELSE %] + <li class="disabled"><a href="#" id="deleteallitems-disabled" data-toggle="tooltip" data-placement="left" title="This record has no items">Delete all items</a></li> + [% END %] [% END %] </ul> -- 1.7.9.5 _______________________________________________ Koha-patches mailing list Koha-patches@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/