1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-01 03:57:15 +00:00

Refactors toggle checkboxes link and switch to SVG icon (#23980).

Patch by Mizuki ISHIKAWA (user:ishikawa999)
 


git-svn-id: https://svn.redmine.org/redmine/trunk@23047 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu 2024-09-09 15:50:37 +00:00
parent 053326b660
commit e8879d891f
4 changed files with 13 additions and 29 deletions

View File

@ -1597,11 +1597,13 @@ module ApplicationHelper
link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)")
end
def toggle_checkboxes_link(selector)
link_to_function '',
def toggle_checkboxes_link(selector, options={})
css_classes = 'icon icon-checked'
css_classes += ' ' + options[:class] if options[:class]
link_to_function icon_with_label('checked', ''),
"toggleCheckboxesBySelector('#{selector}')",
:title => "#{l(:button_check_all)} / #{l(:button_uncheck_all)}",
:class => 'icon icon-checked'
:class => css_classes
end
def progress_bar(pcts, options={})

View File

@ -37,10 +37,7 @@
<th><%=l(:label_permissions)%></th>
<% @roles.each do |role| %>
<th>
<%= link_to_function('',
"toggleCheckboxesBySelector('input.role-#{role.id}')",
:title => "#{l(:button_check_all)} / #{l(:button_uncheck_all)}",
:class => 'icon-only icon-checked') %>
<%= toggle_checkboxes_link("input.role-#{role.id}") %>
<%= content_tag(role.builtin? ? 'em' : 'span', role.name) %>
</th>
<% end %>
@ -64,10 +61,7 @@
<% humanized_perm_name = l_or_humanize(permission.name, :prefix => 'permission_') %>
<tr class="permission-<%= permission.name %>">
<td class="name">
<%= link_to_function('',
"toggleCheckboxesBySelector('.permission-#{permission.name} input')",
:title => "#{l(:button_check_all)} / #{l(:button_uncheck_all)}",
:class => 'icon-only icon-checked') %>
<%= toggle_checkboxes_link(".permission-#{permission.name} input") %>
<%= humanized_perm_name %>
</td>
<% @roles.each do |role| %>

View File

@ -9,9 +9,7 @@
<th></th>
<% @trackers.each do |tracker| %>
<th>
<%= link_to_function('', "toggleCheckboxesBySelector('input.tracker-#{tracker.id}')",
:title => "#{l(:button_check_all)} / #{l(:button_uncheck_all)}",
:class => 'icon-only icon-checked') %>
<%= toggle_checkboxes_link("input.tracker-#{tracker.id}") %>
<%= tracker.name %>
</th>
<% end %>
@ -28,9 +26,7 @@
<tr>
<% field_name = l("field_#{field}".delete_suffix('_id')) %>
<td class="name">
<%= link_to_function('', "toggleCheckboxesBySelector('input.core-field-#{field}')",
:title => "#{l(:button_check_all)} / #{l(:button_uncheck_all)}",
:class => 'icon-only icon-checked') %>
<%= toggle_checkboxes_link("input.core-field-#{field}") %>
<%= field_name %>
</td>
<% @trackers.each do |tracker| %>
@ -51,9 +47,7 @@
<% @custom_fields.each do |field| %>
<tr>
<td class="name">
<%= link_to_function('', "toggleCheckboxesBySelector('input.custom-field-#{field.id}')",
:title => "#{l(:button_check_all)} / #{l(:button_uncheck_all)}",
:class => 'icon-only icon-checked') %>
<%= toggle_checkboxes_link("input.custom-field-#{field.id}") %>
<%= field.name %>
</td>
<% @trackers.each do |tracker| %>

View File

@ -2,9 +2,7 @@
<thead>
<tr>
<th>
<%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input[type=checkbox]:not(:disabled)')",
:title => "#{l(:button_check_all)} / #{l(:button_uncheck_all)}",
:class => 'no-tooltip icon-only icon-checked') %>
<%= toggle_checkboxes_link("table.transitions-#{name} input[type=checkbox]:not(:disabled)", { class: 'no-tooltip' }) %>
<%=l(:label_current_status)%>
</th>
<th colspan="<%= @statuses.length %>"><%=l(:label_new_statuses_allowed)%></th>
@ -13,9 +11,7 @@
<td></td>
<% for new_status in @statuses %>
<td style="width:<%= 75 / @statuses.size %>%;">
<%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input[type=checkbox]:not(:disabled).new-status-#{new_status.id}')",
:title => "#{l(:button_check_all)} / #{l(:button_uncheck_all)}",
:class => 'no-tooltip icon-only icon-checked') %>
<%= toggle_checkboxes_link("table.transitions-#{name} input[type=checkbox]:not(:disabled).new-status-#{new_status.id}", { class: 'no-tooltip' }) %>
<%= new_status.name %>
</td>
<% end %>
@ -27,9 +23,7 @@
<% next if old_status.nil? && name != 'always' %>
<tr>
<td class="name">
<%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input[type=checkbox]:not(:disabled).old-status-#{old_status.try(:id) || 0}')",
:title => "#{l(:button_check_all)} / #{l(:button_uncheck_all)}",
:class => 'no-tooltip icon-only icon-checked') %>
<%= toggle_checkboxes_link("table.transitions-#{name} input[type=checkbox]:not(:disabled).old-status-#{old_status.try(:id) || 0}", { class: 'no-tooltip' }) %>
<% if old_status %>
<% old_status_name = old_status.name %>
<%= old_status_name %>