Bug 19641: (follow-up) Fix update child menu option

This follow-up corrects handling of clicks on the "Update child" menu
option when the patron is an adult. Previously the click handler was
conditionally added via template markup. This patch modifies it to use
the data-tooltip attribute as an indicator that the option is disabled.

To test, apply the patch and clear your browser cache if necessary.

- Open an adult patron's record for viewing.
- Choose More -> Update child from the toolbar menu.
- The menu item should be disabled, and should show a tooltip.
- Clicking the menu item should do nothing.

- Open a child patron's record for viewing.
- Choose More -> Update child from the toolbar menu.
- The patron should be updated to an adult category.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Owen Leonard 2018-01-26 13:12:16 +00:00 committed by Jonathan Druart
parent 4fc473e04d
commit de454ff552
1 changed files with 7 additions and 3 deletions

View File

@ -57,9 +57,13 @@ $(document).ready(function(){
$(".btn-group").removeClass("open");
return false;
});
$("#updatechild").click(function(){
update_child();
$(".btn-group").removeClass("open");
$("#updatechild").click(function(e){
if( $(this).data("toggle") == "tooltip"){ // Disabled menu option has tooltip attribute
e.preventDefault();
} else {
update_child();
$(".btn-group").removeClass("open");
}
});
}