]> source.dussan.org Git - redmine.git/commitdiff
Adds (un)check all buttons to select all projects (#11702).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 2 Nov 2014 20:16:59 +0000 (20:16 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 2 Nov 2014 20:16:59 +0000 (20:16 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@13537 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
app/views/principal_memberships/_new_form.html.erb

index 3a40fd2e222a66a6f51790bf54ec396c9291f2ce..6476fba5174108eafe374c92fc5c29587b32ae0a 100644 (file)
@@ -1119,6 +1119,12 @@ module ApplicationHelper
     link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)")
   end
 
+  def toggle_checkboxes_link(selector)
+    link_to_function image_tag('toggle_check.png'),
+      "toggleCheckboxesBySelector('#{selector}')",
+      :title => "#{l(:button_check_all)} / #{l(:button_uncheck_all)}"
+  end
+
   def progress_bar(pcts, options={})
     pcts = [pcts, pcts] unless pcts.is_a?(Array)
     pcts = pcts.collect(&:round)
index bdd7df64c08d908c5d4c33f3b41b9cfe13626177..2a0d50dbccb877c734a892bc4f929556db8b0622 100644 (file)
@@ -1,5 +1,5 @@
 <fieldset class="box">
-  <legend><%= l(:label_project_plural) %></legend>
+  <legend><%= l(:label_project_plural) %> <%= toggle_checkboxes_link('.projects-selection input:enabled') %></legend>
   <div style="max-height:300px; overflow:auto;">
     <div class="projects-selection">
     <%= render_project_nested_lists(@projects) do |p| %>
 </fieldset>
 
 <fieldset class="box">
-  <legend><%= l(:label_role_plural) %></legend>
+  <legend><%= l(:label_role_plural) %> <%= toggle_checkboxes_link('.roles-selection input') %></legend>
+  <div class="roles-selection">
   <% @roles.each do |role| %>
-    <label class="inline">
+    <label>
       <%= check_box_tag 'membership[role_ids][]', role.id, false, :id => nil %>
-      <%=h role %>
+      <%= role %>
     </label>
   <% end %>
+  </div>
 </fieldset>