Commit 3ffde74a authored by jplang's avatar jplang

Let the context menu work on elements that are not tr.

git-svn-id: https://svn.redmine.org/redmine/trunk@16508 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 7a81099d
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment