change_toggle_checkboxes_link_to_toggle_checkbox_button.patch

Mizuki ISHIKAWA, 2017-11-30 01:51

Download (8.18 KB)

View differences:

app/helpers/application_helper.rb
1252 1252
    link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)")
1253 1253
  end
1254 1254

  
1255
  def toggle_checkboxes_link(selector)
1256
    link_to_function '',
1257
      "toggleCheckboxesBySelector('#{selector}')",
1255
  def toggle_checkboxes_button(selector)
1256
    button_tag '',
1257
      :type => 'button',
1258
      :onclick => "toggleCheckboxesBySelector('#{selector}')",
1258 1259
      :title => "#{l(:button_check_all)} / #{l(:button_uncheck_all)}",
1259
      :class => 'toggle-checkboxes'
1260
      :class => 'toggle-checkboxes' do
1261
        content_tag('span', '', :class => 'icon-only icon-checked')
1262
      end
1260 1263
  end
1261 1264

  
1262 1265
  def progress_bar(pcts, options={})
app/views/members/_new_form.html.erb
7 7
  </div>
8 8
</fieldset>
9 9
<fieldset class="box">
10
  <legend><%= l(:label_role_plural) %> <%= toggle_checkboxes_link('.roles-selection input') %></legend>
10
  <legend><%= l(:label_role_plural) %> <%= toggle_checkboxes_button('.roles-selection input') %></legend>
11 11
  <div class="roles-selection">
12 12
    <% User.current.managed_roles(@project).each do |role| %>
13 13
      <label><%= check_box_tag 'membership[role_ids][]', role.id, false, :id => nil %> <%= role %></label>
app/views/principal_memberships/_new_form.html.erb
1 1
<fieldset class="box">
2
  <legend><%= l(:label_project_plural) %> <%= toggle_checkboxes_link('.projects-selection input:enabled') %></legend>
2
  <legend><%= l(:label_project_plural) %> <%= toggle_checkboxes_button('.projects-selection input:enabled') %></legend>
3 3
  <div class="objects-selection">
4 4
    <div class="projects-selection">
5 5
    <%= render_project_nested_lists(@projects) do |p| %>
......
12 12
</fieldset>
13 13

  
14 14
<fieldset class="box">
15
  <legend><%= l(:label_role_plural) %> <%= toggle_checkboxes_link('.roles-selection input') %></legend>
15
  <legend><%= l(:label_role_plural) %> <%= toggle_checkboxes_button('.roles-selection input') %></legend>
16 16
  <div class="roles-selection">
17 17
  <% @roles.each do |role| %>
18 18
    <label>
app/views/roles/permissions.html.erb
9 9
    <th><%=l(:label_permissions)%></th>
10 10
    <% @roles.each do |role| %>
11 11
    <th>
12
        <%= link_to_function('',
13
                             "toggleCheckboxesBySelector('input.role-#{role.id}')",
14
                             :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
15
                             :class => 'icon-only icon-checked') %>
12
        <%= toggle_checkboxes_button("input.role-#{role.id}") %>
16 13
        <%= content_tag(role.builtin? ? 'em' : 'span', role.name) %>
17 14
    </th>
18 15
    <% end %>
......
36 33
        <% humanized_perm_name = l_or_humanize(permission.name, :prefix => 'permission_') %>
37 34
        <tr class="permission-<%= permission.name %>">
38 35
        <td class="name">
39
            <%= link_to_function('',
40
                                 "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
41
                                 :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
42
                                 :class => 'icon-only icon-checked') %>
36
            <%= toggle_checkboxes_button(".permission-#{permission.name} input") %>
43 37
            <%= humanized_perm_name %>
44 38
        </td>
45 39
        <% @roles.each do |role| %>
app/views/trackers/fields.html.erb
9 9
        <th></th>
10 10
        <% @trackers.each do |tracker| %>
11 11
        <th>
12
          <%= link_to_function('', "toggleCheckboxesBySelector('input.tracker-#{tracker.id}')",
13
                               :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
14
                               :class => 'icon-only icon-checked') %>
12
          <%= toggle_checkboxes_button("input.tracker-#{tracker.id}") %>
15 13
          <%= tracker.name %>
16 14
        </th>
17 15
        <% end %>
......
28 26
      <tr>
29 27
        <% field_name = l("field_#{field}".sub(/_id$/, '')) %>
30 28
        <td class="name">
31
          <%= link_to_function('', "toggleCheckboxesBySelector('input.core-field-#{field}')",
32
                               :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
33
                               :class => 'icon-only icon-checked') %>
29
          <%= toggle_checkboxes_button("input.core-field-#{field}") %>
34 30
          <%= field_name %>
35 31
        </td>
36 32
        <% @trackers.each do |tracker| %>
......
51 47
        <% @custom_fields.each do |field| %>
52 48
        <tr>
53 49
          <td class="name">
54
            <%= link_to_function('', "toggleCheckboxesBySelector('input.custom-field-#{field.id}')",
55
                                 :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
56
                                 :class => 'icon-only icon-checked') %>
50
            <%= toggle_checkboxes_button("input.custom-field-#{field.id}") %>
57 51
            <%= field.name %>
58 52
          </td>
59 53
          <% @trackers.each do |tracker| %>
app/views/workflows/_form.html.erb
2 2
<thead>
3 3
  <tr>
4 4
    <th>
5
      <%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input[type=checkbox]')",
6
                           :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
7
                           :class => 'icon-only icon-checked') %>
5
      <%= toggle_checkboxes_button("table.transitions-#{name} input[type=checkbox]") %>
8 6
      <%=l(:label_current_status)%>
9 7
    </th>
10 8
    <th colspan="<%= @statuses.length %>"><%=l(:label_new_statuses_allowed)%></th>
......
13 11
    <td></td>
14 12
    <% for new_status in @statuses %>
15 13
    <td style="width:<%= 75 / @statuses.size %>%;">
16
      <%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input[type=checkbox].new-status-#{new_status.id}')",
17
                           :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
18
                           :class => 'icon-only icon-checked') %>
14
      <%= toggle_checkboxes_button("table.transitions-#{name} input[type=checkbox].new-status-#{new_status.id}") %>
19 15
      <%= new_status.name %>
20 16
    </td>
21 17
    <% end %>
......
26 22
  <% next if old_status.nil? && name != 'always' %>
27 23
  <tr>
28 24
    <td class="name">
29
      <%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input[type=checkbox].old-status-#{old_status.try(:id) || 0}')",
30
                           :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
31
                           :class => 'icon-only icon-checked') %>
25
      <%= toggle_checkboxes_button("table.transitions-#{name} input[type=checkbox].old-status-#{old_status.try(:id) || 0}") %>
32 26
      <% if old_status %>
33 27
        <% old_status_name = old_status.name %>
34 28
        <%= old_status_name %>
public/stylesheets/application.css
140 140

  
141 141
a#toggle-completed-versions {color:#999;}
142 142

  
143
a.toggle-checkboxes { margin-left: 5px; padding-left: 12px; background: url(../images/toggle_check.png) no-repeat 0% 50%; }
143
button.toggle-checkboxes { padding: 0px 0px 1px 4px;}
144 144

  
145 145
/***** Dropdown *****/
146 146
.drdn {position:relative;}