@@ -5,9 +5,8 | |||||
5 | <thead> |
|
5 | <thead> | |
6 | <tr> |
|
6 | <tr> | |
7 | <th class="checkbox hide-when-print"> |
|
7 | <th class="checkbox hide-when-print"> | |
8 | <%= link_to image_tag('toggle_check.png'), {}, |
|
8 | <%= check_box_tag 'check_all', '', false, :class => 'toggle-selection', | |
9 | :onclick => 'toggleIssuesSelection(this); return false;', |
|
9 | :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> | |
10 | :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> |
|
|||
11 | </th> |
|
10 | </th> | |
12 | <% query.inline_columns.each do |column| %> |
|
11 | <% query.inline_columns.each do |column| %> | |
13 | <%= column_header(column) %> |
|
12 | <%= column_header(column) %> |
@@ -5,9 +5,7 | |||||
5 | <thead> |
|
5 | <thead> | |
6 | <tr> |
|
6 | <tr> | |
7 | <th class="checkbox hide-when-print"> |
|
7 | <th class="checkbox hide-when-print"> | |
8 | <%= link_to image_tag('toggle_check.png'), |
|
8 | <%= check_box_tag 'check_all', '', false, :class => 'toggle-selection', | |
9 | {}, |
|
|||
10 | :onclick => 'toggleIssuesSelection(this); return false;', |
|
|||
11 | :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> |
|
9 | :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %> | |
12 | </th> |
|
10 | </th> | |
13 | <% @query.inline_columns.each do |column| %> |
|
11 | <% @query.inline_columns.each do |column| %> |
@@ -67,6 +67,8 function contextMenuClick(event) { | |||||
67 | // click is outside the rows |
|
67 | // click is outside the rows | |
68 | if (target.is('a') && (target.hasClass('disabled') || target.hasClass('submenu'))) { |
|
68 | if (target.is('a') && (target.hasClass('disabled') || target.hasClass('submenu'))) { | |
69 | event.preventDefault(); |
|
69 | event.preventDefault(); | |
|
70 | } else if (target.is('.toggle-selection')) { | |||
|
71 | // nop | |||
70 | } else { |
|
72 | } else { | |
71 | contextMenuUnselectAll(); |
|
73 | contextMenuUnselectAll(); | |
72 | } |
|
74 | } | |
@@ -149,6 +151,7 function contextMenuLastSelected() { | |||||
149 | } |
|
151 | } | |
150 |
|
152 | |||
151 | function contextMenuUnselectAll() { |
|
153 | function contextMenuUnselectAll() { | |
|
154 | $('input[type=checkbox].toggle-selection').prop('checked', false); | |||
152 | $('.hascontextmenu').each(function(){ |
|
155 | $('.hascontextmenu').each(function(){ | |
153 | contextMenuRemoveSelection($(this)); |
|
156 | contextMenuRemoveSelection($(this)); | |
154 | }); |
|
157 | }); | |
@@ -208,18 +211,9 function contextMenuInit(url) { | |||||
208 | } |
|
211 | } | |
209 |
|
212 | |||
210 | function toggleIssuesSelection(el) { |
|
213 | function toggleIssuesSelection(el) { | |
211 | var boxes = $(el).parents('form').find('input[type=checkbox]'); |
|
214 | var checked = $(this).prop('checked'); | |
212 | var all_checked = true; |
|
215 | var boxes = $(this).parents('table').find('input[name=ids\\[\\]]'); | |
213 | boxes.each(function(){ if (!$(this).prop('checked')) { all_checked = false; } }); |
|
216 | boxes.prop('checked', checked).parents('tr').toggleClass('context-menu-selection', checked); | |
214 | boxes.each(function(){ |
|
|||
215 | if (all_checked) { |
|
|||
216 | $(this).removeAttr('checked'); |
|
|||
217 | $(this).parents('tr').removeClass('context-menu-selection'); |
|
|||
218 | } else if (!$(this).prop('checked')) { |
|
|||
219 | $(this).prop('checked', true); |
|
|||
220 | $(this).parents('tr').addClass('context-menu-selection'); |
|
|||
221 | } |
|
|||
222 | }); |
|
|||
223 | } |
|
217 | } | |
224 |
|
218 | |||
225 | function window_size() { |
|
219 | function window_size() { | |
@@ -237,3 +231,7 function window_size() { | |||||
237 | } |
|
231 | } | |
238 | return {width: w, height: h}; |
|
232 | return {width: w, height: h}; | |
239 | } |
|
233 | } | |
|
234 | ||||
|
235 | $(document).ready(function(){ | |||
|
236 | $('input[type=checkbox].toggle-selection').on('change', toggleIssuesSelection); | |||
|
237 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now