Project

General

Profile

Patch #42081 » bulk_edit.html.erb

redmine-5.1.3\app\views\issues - Alfredo Renzetti, 2025-01-07 16:41

 
1
<h2><%= @copy ? l(:button_copy) : l(:label_bulk_edit_selected_issues) %></h2>
2

    
3
<% if @saved_issues && @unsaved_issues.present? %>
4
<div id="errorExplanation">
5
  <span>
6
    <%= l(:notice_failed_to_save_issues,
7
        :count => @unsaved_issues.size,
8
        :total => @saved_issues.size,
9
        :ids => @unsaved_issues.map {|i| "##{i.id}"}.join(', ')) %>
10
  </span>
11
  <ul>
12
  <% bulk_edit_error_messages(@unsaved_issues).each do |message| %>
13
    <li><%= message %></li>
14
  <% end %>
15
  </ul>
16
</div>
17
<% end %>
18

    
19
<ul id="bulk-selection">
20
<% @issues.each do |issue| %>
21
  <%= content_tag 'li', link_to_issue(issue) %>
22
<% end %>
23
</ul>
24

    
25
<%= form_tag(bulk_update_issues_path, :id => 'bulk_edit_form') do %>
26
<%= @issues.collect {|i| hidden_field_tag('ids[]', i.id, :id => nil)}.join("\n").html_safe %>
27
<div class="box tabular">
28
<fieldset class="attributes">
29
<legend><%= l(:label_change_properties) %></legend>
30

    
31
<div class="splitcontent">
32
<div class="splitcontentleft">
33
<% if @allowed_projects.present? %>
34
<p>
35
  <label for="issue_project_id"><%= l(:field_project) %></label>
36
  <%= select_tag('issue[project_id]',
37
                 project_tree_options_for_select(@allowed_projects,
38
                   :include_blank => ((!@copy || (@projects & @allowed_projects == @projects)) ? l(:label_no_change_option) : false),
39
                   :selected => @target_project),
40
                 :onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')") %>
41
</p>
42
<% end %>
43
<p>
44
  <label for="issue_tracker_id"><%= l(:field_tracker) %></label>
45
  <%= select_tag('issue[tracker_id]',
46
                 content_tag('option', l(:label_no_change_option), :value => '') +
47
                   options_from_collection_for_select(@trackers, :id, :name, @issue_params[:tracker_id]),
48
                   :onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')") %>
49
</p>
50
<% if @available_statuses.any? %>
51
<p>
52
  <label for='issue_status_id'><%= l(:field_status) %></label>
53
  <%= select_tag('issue[status_id]',
54
                 content_tag('option', l(:label_no_change_option), :value => '') +
55
                   options_from_collection_for_select(@available_statuses, :id, :name, @issue_params[:status_id]),
56
                   :onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')") %>
57
</p>
58
<% end %>
59

    
60
<% if @safe_attributes.include?('priority_id') -%>
61
<p>
62
  <label for='issue_priority_id'><%= l(:field_priority) %></label>
63
  <%= select_tag('issue[priority_id]',
64
                 content_tag('option', l(:label_no_change_option), :value => '') +
65
                   options_from_collection_for_select(IssuePriority.active, :id, :name, @issue_params[:priority_id])) %>
66
</p>
67
<% end %>
68

    
69
<% if @safe_attributes.include?('assigned_to_id') -%>
70
<p>
71
  <label for='issue_assigned_to_id'><%= l(:field_assigned_to) %></label>
72
  <%= select_tag('issue[assigned_to_id]',
73
                 content_tag('option', l(:label_no_change_option), :value => '') +
74
                   content_tag('option', l(:label_nobody), :value => 'none', :selected => (@issue_params[:assigned_to_id] == 'none')) +
75
                   principals_options_for_select(@assignables, @issue_params[:assigned_to_id])) %>
76
</p>
77
<% end %>
78

    
79
<% if @safe_attributes.include?('category_id') -%>
80
<p>
81
  <label for='issue_category_id'><%= l(:field_category) %></label>
82
  <%= select_tag('issue[category_id]', content_tag('option', l(:label_no_change_option), :value => '') +
83
                                content_tag('option', l(:label_none), :value => 'none', :selected => (@issue_params[:category_id] == 'none')) +
84
                                options_from_collection_for_select(@categories, :id, :name, @issue_params[:category_id])) %>
85
</p>
86
<% end %>
87

    
88
<% if @safe_attributes.include?('fixed_version_id') -%>
89
<p>
90
  <label for='issue_fixed_version_id'><%= l(:field_fixed_version) %></label>
91
  <%= select_tag('issue[fixed_version_id]', content_tag('option', l(:label_no_change_option), :value => '') +
92
                                   content_tag('option', l(:label_none), :value => 'none', :selected => (@issue_params[:fixed_version_id] == 'none')) +
93
                                   version_options_for_select(@versions.sort, @issue_params[:fixed_version_id])) %>
94
</p>
95
<% end %>
96

    
97
<% if @copy && Setting.link_copied_issue == 'ask' %>
98
<p>
99
  <label for='link_copy'><%= l(:label_link_copied_issue) %></label>
100
  <%= hidden_field_tag 'link_copy', '0' %>
101
  <%= check_box_tag 'link_copy', '1', params[:link_copy] != 0 %>
102
</p>
103
<% end %>
104

    
105
<!-- ALF: Added "|| @following_tasks_present" -->
106
<% if @copy && (@attachments_present || @subtasks_present || @watchers_present || @following_tasks_present) %>
107
<p>
108
  <label><%= l(:button_copy) %></label>
109
  <% if @attachments_present %>
110
    <label class="block">
111
      <%= hidden_field_tag 'copy_attachments', '0' %>
112
      <%= check_box_tag 'copy_attachments', '1', params[:copy_attachments] != '0' %>
113
      <%= l(:label_attachment_plural) %>
114
    </label>
115
  <% end %>
116
  <!-- ALF -->
117
  <% if @following_tasks_present %>                                                         
118
    <label class="block">                                                                   
119
      <%= hidden_field_tag 'copy_follows', '0' %>                                   
120
      <%= check_box_tag 'copy_follows', '1', params[:copy_follows] != '0' %>
121
      <%= l(:label_following_tasks) %>                                                      
122
    </label>                                                                                
123
  <% end %>                                                                                 
124
  <!-- /ALF -->
125
  <% if @subtasks_present %>
126
    <label class="block">
127
      <%= hidden_field_tag 'copy_subtasks', '0' %>
128
      <%= check_box_tag 'copy_subtasks', '1', params[:copy_subtasks] != '0' %>
129
      <%= l(:label_subtask_plural) %>
130
    </label>
131
  <% end %>
132
  <% if @watchers_present %>
133
    <label class="block">
134
      <%= hidden_field_tag 'copy_watchers', '0' %>
135
      <%= check_box_tag 'copy_watchers', '1',  params[:copy_watchers] != '0' %>
136
      <%= l(:label_issue_watchers) %>
137
    </label>
138
  <% end %>
139
</p>
140
<% end %>
141

    
142
<%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %>
143
</div>
144

    
145
<div class="splitcontentright">
146
<% if @safe_attributes.include?('is_private') %>
147
<p>
148
  <label for='issue_is_private'><%= l(:field_is_private) %></label>
149
  <%= select_tag('issue[is_private]', content_tag('option', l(:label_no_change_option), :value => '') +
150
                                content_tag('option', l(:general_text_Yes), :value => '1', :selected => (@issue_params[:is_private] == '1')) +
151
                                content_tag('option', l(:general_text_No), :value => '0', :selected => (@issue_params[:is_private] == '0'))) %>
152
</p>
153
<% end %>
154

    
155
<% if @safe_attributes.include?('parent_issue_id') && @project %>
156
<p>
157
  <label for='issue_parent_issue_id'><%= l(:field_parent_issue) %></label>
158
  <%= text_field_tag 'issue[parent_issue_id]', '', :size => 10, :value => @issue_params[:parent_issue_id] %>
159
  <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>
160
</p>
161
<%= javascript_tag "observeAutocompleteField('issue_parent_issue_id', '#{escape_javascript auto_complete_issues_path(:project_id => @project, :scope => Setting.cross_project_subtasks)}')" %>
162
<% end %>
163

    
164
<% if @safe_attributes.include?('start_date') %>
165
<p>
166
  <label for='issue_start_date'><%= l(:field_start_date) %></label>
167
  <%= date_field_tag 'issue[start_date]', '', :value => @issue_params[:start_date], :size => 10 %><%= calendar_for('issue_start_date') %>
168
  <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>
169
</p>
170
<% end %>
171

    
172
<% if @safe_attributes.include?('due_date') %>
173
<p>
174
  <label for='issue_due_date'><%= l(:field_due_date) %></label>
175
  <%= date_field_tag 'issue[due_date]', '', :value => @issue_params[:due_date], :size => 10 %><%= calendar_for('issue_due_date') %>
176
  <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>
177
</p>
178
<% end %>
179

    
180
<% if @safe_attributes.include?('estimated_hours') %>
181
<p>
182
  <label for='issue_estimated_hours'><%= l(:field_estimated_hours) %></label>
183
  <%= text_field_tag 'issue[estimated_hours]', '', :value => @issue_params[:estimated_hours], :size => 10 %>
184
  <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>
185
</p>
186
<% end %>
187

    
188
<% if @safe_attributes.include?('done_ratio') && Issue.use_field_for_done_ratio? %>
189
<p>
190
  <label for='issue_done_ratio'><%= l(:field_done_ratio) %></label>
191
  <%= 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]) %>
192
</p>
193
<% end %>
194
</div>
195
</div>
196

    
197
<% custom_fields = @custom_fields %>
198
<% custom_fields_full_width = custom_fields.select { |value| value.full_width_layout? } %>
199
<% custom_fields -= custom_fields_full_width %>
200

    
201
<% if custom_fields.present? %>
202
<div class="splitcontent">
203
  <div class="splitcontentleft">
204
   <% i = 0 %>
205
   <% split_on = (custom_fields.size / 2.0).ceil - 1 %>
206
   <% custom_fields.each do |custom_field| %>
207
     <p>
208
       <label><%= custom_field.name %></label>
209
       <%= custom_field_tag_for_bulk_edit('issue', custom_field, @issues, @issue_params[:custom_field_values][custom_field.id.to_s]) %>
210
     </p>
211
     <% if i == split_on %>
212
       </div><div class="splitcontentright">
213
     <% end %>
214
     <% i += 1 %>
215
   <% end %>
216
  </div>
217
</div>
218
<% end %>
219

    
220
<% custom_fields_full_width.each do |custom_field| %>
221
  <p>
222
    <label><%= custom_field.name %></label>
223
    <%= custom_field_tag_for_bulk_edit('issue', custom_field, @issues, @issue_params[:custom_field_values][custom_field.id.to_s]) %>
224
  </p>
225
  <%= wikitoolbar_for "issue_custom_field_values_#{custom_field.id}", preview_issue_path(:project_id => @project, :issue_id => nil) if custom_field.full_text_formatting? %>
226
<% end %>
227

    
228
</fieldset>
229

    
230
<fieldset>
231
<legend><%= l(:field_notes) %></legend>
232
<%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit',
233
                  :data => {
234
                      :auto_complete => true
235
                  }
236
%>
237
<%= wikitoolbar_for 'notes' %>
238

    
239
<% if User.current.allowed_to?(:add_issue_watchers, nil, global: true)%>
240
  <%= update_data_sources_for_auto_complete({users: watchers_autocomplete_for_mention_path(q: '', object_type: 'issue', object_id: @issues.map(&:id) )}) %>
241
<% end %>
242

    
243
<% if @safe_attributes.include?('private_notes') %>
244
  <label class="inline">
245
  	<%= check_box_tag 'issue[private_notes]', 1, false %>
246
  	<%= l(:field_private_notes) %>
247
  </label>
248
<% end %>
249
</fieldset>
250
</div>
251

    
252
<% if @values_by_custom_field.present? %>
253
<div class="flash warning">
254
  <%= l(:warning_fields_cleared_on_bulk_edit) %>:<br />
255
  <%= safe_join(@values_by_custom_field.map {|field, ids| content_tag "span", "#{field.name} (#{ids.size})"}, ', ') %>
256
</div>
257
<% end %>
258

    
259
<p>
260
  <% if @copy %>
261
    <%= hidden_field_tag 'copy', '1' %>
262
    <%= submit_tag l(:button_copy) %>
263
    <%= submit_tag l(:button_copy_and_follow), :name => 'follow' %>
264
  <% elsif @target_project %>
265
    <%= submit_tag l(:button_move) %>
266
    <%= submit_tag l(:button_move_and_follow), :name => 'follow' %>
267
  <% else %>
268
    <%= submit_tag l(:button_submit) %>
269
  <% end %>
270
</p>
271

    
272
<% end %>
273

    
274
<%= javascript_tag do %>
275
$(window).on('load', function(){
276
  $(document).on('change', 'input[data-disables]', function(){
277
    if ($(this).prop('checked')){
278
      $($(this).data('disables')).attr('disabled', true).val('');
279
    } else {
280
      $($(this).data('disables')).attr('disabled', false);
281
    }
282
  });
283
});
284
$(document).ready(function(){
285
  $('input[data-disables]').trigger('change');
286
});
287
<% end %>
(3-3/5)