選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

bulk_edit.html.erb 10.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <h2><%= @copy ? l(:button_copy) : l(:label_bulk_edit_selected_issues) %></h2>
  2. <% if @saved_issues && @unsaved_issues.present? %>
  3. <div id="errorExplanation">
  4. <span>
  5. <%= l(:notice_failed_to_save_issues,
  6. :count => @unsaved_issues.size,
  7. :total => @saved_issues.size,
  8. :ids => @unsaved_issues.map {|i| "##{i.id}"}.join(', ')) %>
  9. </span>
  10. <ul>
  11. <% bulk_edit_error_messages(@unsaved_issues).each do |message| %>
  12. <li><%= message %></li>
  13. <% end %>
  14. </ul>
  15. </div>
  16. <% end %>
  17. <ul id="bulk-selection">
  18. <% @issues.each do |issue| %>
  19. <%= content_tag 'li', link_to_issue(issue) %>
  20. <% end %>
  21. </ul>
  22. <%= form_tag(bulk_update_issues_path, :id => 'bulk_edit_form') do %>
  23. <%= @issues.collect {|i| hidden_field_tag('ids[]', i.id, :id => nil)}.join("\n").html_safe %>
  24. <div class="box tabular">
  25. <fieldset class="attributes">
  26. <legend><%= l(:label_change_properties) %></legend>
  27. <div class="splitcontentleft">
  28. <% if @allowed_projects.present? %>
  29. <p>
  30. <label for="issue_project_id"><%= l(:field_project) %></label>
  31. <%= select_tag('issue[project_id]',
  32. project_tree_options_for_select(@allowed_projects,
  33. :include_blank => ((!@copy || (@projects & @allowed_projects == @projects)) ? l(:label_no_change_option) : false),
  34. :selected => @target_project),
  35. :onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')") %>
  36. </p>
  37. <% end %>
  38. <p>
  39. <label for="issue_tracker_id"><%= l(:field_tracker) %></label>
  40. <%= select_tag('issue[tracker_id]',
  41. content_tag('option', l(:label_no_change_option), :value => '') +
  42. options_from_collection_for_select(@trackers, :id, :name, @issue_params[:tracker_id]),
  43. :onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')") %>
  44. </p>
  45. <% if @available_statuses.any? %>
  46. <p>
  47. <label for='issue_status_id'><%= l(:field_status) %></label>
  48. <%= select_tag('issue[status_id]',
  49. content_tag('option', l(:label_no_change_option), :value => '') +
  50. options_from_collection_for_select(@available_statuses, :id, :name, @issue_params[:status_id]),
  51. :onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')") %>
  52. </p>
  53. <% end %>
  54. <% if @safe_attributes.include?('priority_id') -%>
  55. <p>
  56. <label for='issue_priority_id'><%= l(:field_priority) %></label>
  57. <%= select_tag('issue[priority_id]',
  58. content_tag('option', l(:label_no_change_option), :value => '') +
  59. options_from_collection_for_select(IssuePriority.active, :id, :name, @issue_params[:priority_id])) %>
  60. </p>
  61. <% end %>
  62. <% if @safe_attributes.include?('assigned_to_id') -%>
  63. <p>
  64. <label for='issue_assigned_to_id'><%= l(:field_assigned_to) %></label>
  65. <%= select_tag('issue[assigned_to_id]',
  66. content_tag('option', l(:label_no_change_option), :value => '') +
  67. content_tag('option', l(:label_nobody), :value => 'none', :selected => (@issue_params[:assigned_to_id] == 'none')) +
  68. principals_options_for_select(@assignables, @issue_params[:assigned_to_id])) %>
  69. </p>
  70. <% end %>
  71. <% if @safe_attributes.include?('category_id') -%>
  72. <p>
  73. <label for='issue_category_id'><%= l(:field_category) %></label>
  74. <%= select_tag('issue[category_id]', content_tag('option', l(:label_no_change_option), :value => '') +
  75. content_tag('option', l(:label_none), :value => 'none', :selected => (@issue_params[:category_id] == 'none')) +
  76. options_from_collection_for_select(@categories, :id, :name, @issue_params[:category_id])) %>
  77. </p>
  78. <% end %>
  79. <% if @safe_attributes.include?('fixed_version_id') -%>
  80. <p>
  81. <label for='issue_fixed_version_id'><%= l(:field_fixed_version) %></label>
  82. <%= select_tag('issue[fixed_version_id]', content_tag('option', l(:label_no_change_option), :value => '') +
  83. content_tag('option', l(:label_none), :value => 'none', :selected => (@issue_params[:fixed_version_id] == 'none')) +
  84. version_options_for_select(@versions.sort, @issue_params[:fixed_version_id])) %>
  85. </p>
  86. <% end %>
  87. <% @custom_fields.each do |custom_field| %>
  88. <p>
  89. <label><%= custom_field.name %></label>
  90. <%= custom_field_tag_for_bulk_edit('issue', custom_field, @issues, @issue_params[:custom_field_values][custom_field.id.to_s]) %>
  91. </p>
  92. <% end %>
  93. <% if @copy && Setting.link_copied_issue == 'ask' %>
  94. <p>
  95. <label for='link_copy'><%= l(:label_link_copied_issue) %></label>
  96. <%= hidden_field_tag 'link_copy', '0' %>
  97. <%= check_box_tag 'link_copy', '1', params[:link_copy] != 0 %>
  98. </p>
  99. <% end %>
  100. <% if @copy && (@attachments_present || @subtasks_present || @watchers_present) %>
  101. <p>
  102. <label><%= l(:button_copy) %></label>
  103. <% if @attachments_present %>
  104. <label class="block">
  105. <%= hidden_field_tag 'copy_attachments', '0' %>
  106. <%= check_box_tag 'copy_attachments', '1', params[:copy_attachments] != '0' %>
  107. <%= l(:label_attachment_plural) %>
  108. </label>
  109. <% end %>
  110. <% if @subtasks_present %>
  111. <label class="block">
  112. <%= hidden_field_tag 'copy_subtasks', '0' %>
  113. <%= check_box_tag 'copy_subtasks', '1', params[:copy_subtasks] != '0' %>
  114. <%= l(:label_subtask_plural) %>
  115. </label>
  116. <% end %>
  117. <% if @watchers_present %>
  118. <label class="block">
  119. <%= hidden_field_tag 'copy_watchers', '0' %>
  120. <%= check_box_tag 'copy_watchers', '1', params[:copy_watchers] != '0' %>
  121. <%= l(:label_issue_watchers) %>
  122. </label>
  123. <% end %>
  124. </p>
  125. <% end %>
  126. <%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %>
  127. </div>
  128. <div class="splitcontentright">
  129. <% if @safe_attributes.include?('is_private') %>
  130. <p>
  131. <label for='issue_is_private'><%= l(:field_is_private) %></label>
  132. <%= select_tag('issue[is_private]', content_tag('option', l(:label_no_change_option), :value => '') +
  133. content_tag('option', l(:general_text_Yes), :value => '1', :selected => (@issue_params[:is_private] == '1')) +
  134. content_tag('option', l(:general_text_No), :value => '0', :selected => (@issue_params[:is_private] == '0'))) %>
  135. </p>
  136. <% end %>
  137. <% if @safe_attributes.include?('parent_issue_id') && @project %>
  138. <p>
  139. <label for='issue_parent_issue_id'><%= l(:field_parent_issue) %></label>
  140. <%= text_field_tag 'issue[parent_issue_id]', '', :size => 10, :value => @issue_params[:parent_issue_id] %>
  141. <label class="inline"><%= check_box_tag 'issue[parent_issue_id]', 'none', (@issue_params[:parent_issue_id] == 'none'), :id => nil, :data => {:disables => '#issue_parent_issue_id'} %><%= l(:button_clear) %></label>
  142. </p>
  143. <%= javascript_tag "observeAutocompleteField('issue_parent_issue_id', '#{escape_javascript auto_complete_issues_path(:project_id => @project, :scope => Setting.cross_project_subtasks)}')" %>
  144. <% end %>
  145. <% if @safe_attributes.include?('start_date') %>
  146. <p>
  147. <label for='issue_start_date'><%= l(:field_start_date) %></label>
  148. <%= date_field_tag 'issue[start_date]', '', :value => @issue_params[:start_date], :size => 10 %><%= calendar_for('issue_start_date') %>
  149. <label class="inline"><%= check_box_tag 'issue[start_date]', 'none', (@issue_params[:start_date] == 'none'), :id => nil, :data => {:disables => '#issue_start_date'} %><%= l(:button_clear) %></label>
  150. </p>
  151. <% end %>
  152. <% if @safe_attributes.include?('due_date') %>
  153. <p>
  154. <label for='issue_due_date'><%= l(:field_due_date) %></label>
  155. <%= date_field_tag 'issue[due_date]', '', :value => @issue_params[:due_date], :size => 10 %><%= calendar_for('issue_due_date') %>
  156. <label class="inline"><%= check_box_tag 'issue[due_date]', 'none', (@issue_params[:due_date] == 'none'), :id => nil, :data => {:disables => '#issue_due_date'} %><%= l(:button_clear) %></label>
  157. </p>
  158. <% end %>
  159. <% if @safe_attributes.include?('estimated_hours') %>
  160. <p>
  161. <label for='issue_estimated_hours'><%= l(:field_estimated_hours) %></label>
  162. <%= text_field_tag 'issue[estimated_hours]', '', :value => @issue_params[:estimated_hours], :size => 10 %>
  163. <label class="inline"><%= check_box_tag 'issue[estimated_hours]', 'none', (@issue_params[:estimated_hours] == 'none'), :id => nil, :data => {:disables => '#issue_estimated_hours'} %><%= l(:button_clear) %></label>
  164. </p>
  165. <% end %>
  166. <% if @safe_attributes.include?('done_ratio') && Issue.use_field_for_done_ratio? %>
  167. <p>
  168. <label for='issue_done_ratio'><%= l(:field_done_ratio) %></label>
  169. <%= select_tag 'issue[done_ratio]', options_for_select([[l(:label_no_change_option), '']] + (0..10).to_a.collect {|r| ["#{r*10} %", r*10] }, @issue_params[:done_ratio]) %>
  170. </p>
  171. <% end %>
  172. </div>
  173. </fieldset>
  174. <fieldset>
  175. <legend><%= l(:field_notes) %></legend>
  176. <%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %>
  177. <%= wikitoolbar_for 'notes' %>
  178. <% if @safe_attributes.include?('private_notes') %>
  179. <label class="inline">
  180. <%= check_box_tag 'issue[private_notes]', 1, false %>
  181. <%= l(:field_private_notes) %>
  182. </label>
  183. <% end %>
  184. </fieldset>
  185. </div>
  186. <% if @values_by_custom_field.present? %>
  187. <div class="flash warning">
  188. <%= l(:warning_fields_cleared_on_bulk_edit) %>:<br />
  189. <%= safe_join(@values_by_custom_field.map {|field, ids| content_tag "span", "#{field.name} (#{ids.size})"}, ', ') %>
  190. </div>
  191. <% end %>
  192. <p>
  193. <% if @copy %>
  194. <%= hidden_field_tag 'copy', '1' %>
  195. <%= submit_tag l(:button_copy) %>
  196. <%= submit_tag l(:button_copy_and_follow), :name => 'follow' %>
  197. <% elsif @target_project %>
  198. <%= submit_tag l(:button_move) %>
  199. <%= submit_tag l(:button_move_and_follow), :name => 'follow' %>
  200. <% else %>
  201. <%= submit_tag l(:button_submit) %>
  202. <% end %>
  203. </p>
  204. <% end %>
  205. <%= javascript_tag do %>
  206. $(window).load(function(){
  207. $(document).on('change', 'input[data-disables]', function(){
  208. if ($(this).prop('checked')){
  209. $($(this).data('disables')).attr('disabled', true).val('');
  210. } else {
  211. $($(this).data('disables')).attr('disabled', false);
  212. }
  213. });
  214. });
  215. $(document).ready(function(){
  216. $('input[data-disables]').trigger('change');
  217. });
  218. <% end %>