1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-03 22:29:39 +00:00

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
This commit is contained in:
Jean-Philippe Lang 2015-10-23 16:45:27 +00:00
parent 0b19f6ce51
commit c29727dd39
3 changed files with 13 additions and 18 deletions

View File

@ -5,9 +5,8 @@
<thead>
<tr>
<th class="checkbox hide-when-print">
<%= link_to image_tag('toggle_check.png'), {},
:onclick => 'toggleIssuesSelection(this); return false;',
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
<%= check_box_tag 'check_all', '', false, :class => 'toggle-selection',
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
</th>
<% query.inline_columns.each do |column| %>
<%= column_header(column) %>

View File

@ -5,9 +5,7 @@
<thead>
<tr>
<th class="checkbox hide-when-print">
<%= link_to image_tag('toggle_check.png'),
{},
:onclick => 'toggleIssuesSelection(this); return false;',
<%= check_box_tag 'check_all', '', false, :class => 'toggle-selection',
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
</th>
<% @query.inline_columns.each do |column| %>

View File

@ -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);
});