summaryrefslogtreecommitdiffstats
path: root/public/javascripts
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-23 16:45:27 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-23 16:45:27 +0000
commitc29727dd39fa3fac888057c2ffe7059af96d523a (patch)
tree09abbb571a3f2c4c5a6cf007c5223ec5163d45bf /public/javascripts
parent0b19f6ce51ae1fefe4f962151b3e1ed8bb7471c2 (diff)
downloadredmine-c29727dd39fa3fac888057c2ffe7059af96d523a.tar.gz
redmine-c29727dd39fa3fac888057c2ffe7059af96d523a.zip
Replaces the link with a checkbox to select/unselect all items in the list.
git-svn-id: http://svn.redmine.org/redmine/trunk@14729 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'public/javascripts')
-rw-r--r--public/javascripts/context_menu.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/public/javascripts/context_menu.js b/public/javascripts/context_menu.js
index de848a1ed..2b48e351b 100644
--- a/public/javascripts/context_menu.js
+++ b/public/javascripts/context_menu.js
@@ -67,6 +67,8 @@ function contextMenuClick(event) {
// click is outside the rows
if (target.is('a') && (target.hasClass('disabled') || target.hasClass('submenu'))) {
event.preventDefault();
+ } else if (target.is('.toggle-selection')) {
+ // nop
} else {
contextMenuUnselectAll();
}
@@ -149,6 +151,7 @@ function contextMenuLastSelected() {
}
function contextMenuUnselectAll() {
+ $('input[type=checkbox].toggle-selection').prop('checked', false);
$('.hascontextmenu').each(function(){
contextMenuRemoveSelection($(this));
});
@@ -208,18 +211,9 @@ function contextMenuInit(url) {
}
function toggleIssuesSelection(el) {
- var boxes = $(el).parents('form').find('input[type=checkbox]');
- var all_checked = true;
- boxes.each(function(){ if (!$(this).prop('checked')) { all_checked = false; } });
- boxes.each(function(){
- if (all_checked) {
- $(this).removeAttr('checked');
- $(this).parents('tr').removeClass('context-menu-selection');
- } else if (!$(this).prop('checked')) {
- $(this).prop('checked', true);
- $(this).parents('tr').addClass('context-menu-selection');
- }
- });
+ 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);
}
function window_size() {
@@ -237,3 +231,7 @@ function window_size() {
}
return {width: w, height: h};
}
+
+$(document).ready(function(){
+ $('input[type=checkbox].toggle-selection').on('change', toggleIssuesSelection);
+});