Project

General

Profile

Defect #28463 » add-toggle-checkboxes-to-role-permissions-trackers.patch

Mizuki ISHIKAWA, 2018-03-29 08:34

View differences:

app/views/roles/_form.html.erb
78 78
      <% end %>
79 79
  </thead>
80 80
  <tbody>
81
    <tr>
82
      <td class="name"><b><%= l(:label_tracker_all) %></b></td>
81
    <tr class='permissions-all-trackers'>
82
      <td class="name"><%= toggle_checkboxes_link('tr.permissions-all-trackers input[type="checkbox"]') %><b><%= l(:label_tracker_all) %></b></td>
83 83
      <% permissions.each do |permission| %>
84 84
      <td class="<%= "#{permission}_shown" %>">
85 85
        <%= hidden_field_tag "role[permissions_all_trackers][#{permission}]", '0', :id => nil %>
......
92 92
      <% end %>
93 93
    </tr>
94 94
    <% Tracker.sorted.all.each do |tracker| %>
95
    <tr>
96
      <td class="name"><%= tracker.name %></td>
95
    <tr class="permissions-tracker-<%= tracker.id %>">
96
      <td class="name"><%= toggle_checkboxes_link("tr.permissions-tracker-#{tracker.id} input:enabled") %><%= tracker.name %></td>
97 97
      <% permissions.each do |permission| %>
98 98
      <td class="<%= "#{permission}_shown" %>"><%= check_box_tag "role[permissions_tracker_ids][#{permission}][]",
99 99
                tracker.id,
public/javascripts/application.js
10 10
  $(selector).each(function(index) {
11 11
    if (!$(this).is(':checked')) { all_checked = false; }
12 12
  });
13
  $(selector).prop('checked', !all_checked);
13
  $(selector).prop('checked', !all_checked).trigger('change');
14 14
}
15 15

  
16 16
function showAndScrollTo(id, focus) {
(3-3/4)