From: Go MAEDA Date: Wed, 4 Apr 2018 04:15:21 +0000 (+0000) Subject: Adds toggle checkboxes feature to trackers permissions (#28242). X-Git-Tag: 4.0.0~354 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=97a5e99de83a0f454e74b78a660b75a1dba75a4d;p=redmine.git Adds toggle checkboxes feature to trackers permissions (#28242). Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@17256 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/views/roles/_form.html.erb b/app/views/roles/_form.html.erb index f6852daee..d87c6a16b 100644 --- a/app/views/roles/_form.html.erb +++ b/app/views/roles/_form.html.erb @@ -78,8 +78,8 @@ <% end %> - - <%= l(:label_tracker_all) %> + + <%= toggle_checkboxes_link('tr.permissions-all-trackers input[type="checkbox"]') %><%= l(:label_tracker_all) %> <% permissions.each do |permission| %> "> <%= hidden_field_tag "role[permissions_all_trackers][#{permission}]", '0', :id => nil %> @@ -92,8 +92,8 @@ <% end %> <% Tracker.sorted.all.each do |tracker| %> - - <%= tracker.name %> + + <%= toggle_checkboxes_link("tr.permissions-tracker-#{tracker.id} input:enabled") %><%= tracker.name %> <% permissions.each do |permission| %> "><%= check_box_tag "role[permissions_tracker_ids][#{permission}][]", tracker.id, diff --git a/public/javascripts/application.js b/public/javascripts/application.js index b6352fd2a..ac5a6ed55 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -10,7 +10,7 @@ function toggleCheckboxesBySelector(selector) { $(selector).each(function(index) { if (!$(this).is(':checked')) { all_checked = false; } }); - $(selector).prop('checked', !all_checked); + $(selector).prop('checked', !all_checked).trigger('change'); } function showAndScrollTo(id, focus) {