From 97a5e99de83a0f454e74b78a660b75a1dba75a4d Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Wed, 4 Apr 2018 04:15:21 +0000 Subject: [PATCH] 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 --- app/views/roles/_form.html.erb | 8 ++++---- public/javascripts/application.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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) { -- 2.39.5