diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-04-06 17:17:54 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-04-06 17:17:54 +0000 |
commit | 8ea86a8249463e3d848e0490228da63b40d2d0bb (patch) | |
tree | 19ba88566bb6d7de1e349a113b1192a5456a816c /public | |
parent | 2dfec42484c32dc671ea9706a0bae2b942fd15a2 (diff) | |
download | redmine-8ea86a8249463e3d848e0490228da63b40d2d0bb.tar.gz redmine-8ea86a8249463e3d848e0490228da63b40d2d0bb.zip |
Let the context menu work on elements that are not tr.
git-svn-id: http://svn.redmine.org/redmine/trunk@16508 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'public')
-rw-r--r-- | public/javascripts/context_menu.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/public/javascripts/context_menu.js b/public/javascripts/context_menu.js index 6fd509ea6..9ea4675df 100644 --- a/public/javascripts/context_menu.js +++ b/public/javascripts/context_menu.js @@ -6,8 +6,8 @@ var contextMenuObserving; function contextMenuRightClick(event) { var target = $(event.target); if (target.is('a')) {return;} - var tr = target.parents('tr').first(); - if (!tr.hasClass('hascontextmenu')) {return;} + var tr = target.closest('.hascontextmenu').first(); + if (tr.length < 1) {return;} event.preventDefault(); if (!contextMenuIsSelected(tr)) { contextMenuUnselectAll(); @@ -28,8 +28,8 @@ function contextMenuClick(event) { contextMenuHide(); if (target.is('a') || target.is('img')) { return; } if (event.which == 1 || (navigator.appVersion.match(/\bMSIE\b/))) { - var tr = target.parents('tr').first(); - if (tr.length && tr.hasClass('hascontextmenu')) { + var tr = target.closest('.hascontextmenu').first(); + if (tr.length > 0) { // a row was clicked, check if the click was on checkbox if (target.is('input')) { // a checkbox may be clicked @@ -104,6 +104,7 @@ function contextMenuShow(event) { $('#context-menu').html(''); url = $(event.target).parents('form').first().data('cm-url'); + if (url == null) {alert('no url'); return;} $.ajax({ url: url, @@ -224,7 +225,7 @@ function contextMenuInit() { function toggleIssuesSelection(el) { var checked = $(this).prop('checked'); var boxes = $(this).parents('table').find('input[name=ids\\[\\]]'); - boxes.prop('checked', checked).parents('tr').toggleClass('context-menu-selection', checked); + boxes.prop('checked', checked).parents('.hascontextmenu').toggleClass('context-menu-selection', checked); } function window_size() { |