@@ -1,406 +1,407 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | class IssuesController < ApplicationController |
|
19 | 19 | menu_item :new_issue, :only => [:new, :create] |
|
20 | 20 | default_search_scope :issues |
|
21 | 21 | |
|
22 | 22 | before_filter :find_issue, :only => [:show, :edit, :update] |
|
23 | 23 | before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :move, :perform_move, :destroy] |
|
24 | 24 | before_filter :check_project_uniqueness, :only => [:move, :perform_move] |
|
25 | 25 | before_filter :find_project, :only => [:new, :create] |
|
26 | 26 | before_filter :authorize, :except => [:index] |
|
27 | 27 | before_filter :find_optional_project, :only => [:index] |
|
28 | 28 | before_filter :check_for_default_issue_status, :only => [:new, :create] |
|
29 | 29 | before_filter :build_new_issue_from_params, :only => [:new, :create] |
|
30 | 30 | accept_rss_auth :index, :show |
|
31 | 31 | accept_api_auth :index, :show, :create, :update, :destroy |
|
32 | 32 | |
|
33 | 33 | rescue_from Query::StatementInvalid, :with => :query_statement_invalid |
|
34 | 34 | |
|
35 | 35 | helper :journals |
|
36 | 36 | helper :projects |
|
37 | 37 | include ProjectsHelper |
|
38 | 38 | helper :custom_fields |
|
39 | 39 | include CustomFieldsHelper |
|
40 | 40 | helper :issue_relations |
|
41 | 41 | include IssueRelationsHelper |
|
42 | 42 | helper :watchers |
|
43 | 43 | include WatchersHelper |
|
44 | 44 | helper :attachments |
|
45 | 45 | include AttachmentsHelper |
|
46 | 46 | helper :queries |
|
47 | 47 | include QueriesHelper |
|
48 | 48 | helper :repositories |
|
49 | 49 | include RepositoriesHelper |
|
50 | 50 | helper :sort |
|
51 | 51 | include SortHelper |
|
52 | 52 | include IssuesHelper |
|
53 | 53 | helper :timelog |
|
54 | 54 | helper :gantt |
|
55 | 55 | include Redmine::Export::PDF |
|
56 | 56 | |
|
57 | 57 | verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed } |
|
58 | 58 | verify :method => :post, :only => :bulk_update, :render => {:nothing => true, :status => :method_not_allowed } |
|
59 | 59 | verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } |
|
60 | 60 | |
|
61 | 61 | def index |
|
62 | 62 | retrieve_query |
|
63 | 63 | sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) |
|
64 | 64 | sort_update(@query.sortable_columns) |
|
65 | 65 | |
|
66 | 66 | if @query.valid? |
|
67 | 67 | case params[:format] |
|
68 | 68 | when 'csv', 'pdf' |
|
69 | 69 | @limit = Setting.issues_export_limit.to_i |
|
70 | 70 | when 'atom' |
|
71 | 71 | @limit = Setting.feeds_limit.to_i |
|
72 | 72 | when 'xml', 'json' |
|
73 | 73 | @offset, @limit = api_offset_and_limit |
|
74 | 74 | else |
|
75 | 75 | @limit = per_page_option |
|
76 | 76 | end |
|
77 | 77 | |
|
78 | 78 | @issue_count = @query.issue_count |
|
79 | 79 | @issue_pages = Paginator.new self, @issue_count, @limit, params['page'] |
|
80 | 80 | @offset ||= @issue_pages.current.offset |
|
81 | 81 | @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], |
|
82 | 82 | :order => sort_clause, |
|
83 | 83 | :offset => @offset, |
|
84 | 84 | :limit => @limit) |
|
85 | 85 | @issue_count_by_group = @query.issue_count_by_group |
|
86 | 86 | |
|
87 | 87 | respond_to do |format| |
|
88 | 88 | format.html { render :template => 'issues/index', :layout => !request.xhr? } |
|
89 | 89 | format.api { |
|
90 | 90 | Issue.load_relations(@issues) if include_in_api_response?('relations') |
|
91 | 91 | } |
|
92 | 92 | format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") } |
|
93 | 93 | format.csv { send_data(issues_to_csv(@issues, @project, @query, params), :type => 'text/csv; header=present', :filename => 'export.csv') } |
|
94 | 94 | format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'export.pdf') } |
|
95 | 95 | end |
|
96 | 96 | else |
|
97 | 97 | respond_to do |format| |
|
98 | 98 | format.html { render(:template => 'issues/index', :layout => !request.xhr?) } |
|
99 | 99 | format.any(:atom, :csv, :pdf) { render(:nothing => true) } |
|
100 | 100 | format.api { render_validation_errors(@query) } |
|
101 | 101 | end |
|
102 | 102 | end |
|
103 | 103 | rescue ActiveRecord::RecordNotFound |
|
104 | 104 | render_404 |
|
105 | 105 | end |
|
106 | 106 | |
|
107 | 107 | def show |
|
108 | 108 | @journals = @issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC") |
|
109 | 109 | @journals.each_with_index {|j,i| j.indice = i+1} |
|
110 | 110 | @journals.reverse! if User.current.wants_comments_in_reverse_order? |
|
111 | 111 | |
|
112 | 112 | if User.current.allowed_to?(:view_changesets, @project) |
|
113 | 113 | @changesets = @issue.changesets.visible.all |
|
114 | 114 | @changesets.reverse! if User.current.wants_comments_in_reverse_order? |
|
115 | 115 | end |
|
116 | 116 | |
|
117 | 117 | @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } |
|
118 | 118 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current) |
|
119 | 119 | @edit_allowed = User.current.allowed_to?(:edit_issues, @project) |
|
120 | 120 | @priorities = IssuePriority.active |
|
121 | 121 | @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) |
|
122 | 122 | respond_to do |format| |
|
123 | 123 | format.html { |
|
124 | 124 | retrieve_previous_and_next_issue_ids |
|
125 | 125 | render :template => 'issues/show' |
|
126 | 126 | } |
|
127 | 127 | format.api |
|
128 | 128 | format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' } |
|
129 | 129 | format.pdf { send_data(issue_to_pdf(@issue), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") } |
|
130 | 130 | end |
|
131 | 131 | end |
|
132 | 132 | |
|
133 | 133 | # Add a new issue |
|
134 | 134 | # The new issue will be created from an existing one if copy_from parameter is given |
|
135 | 135 | def new |
|
136 | 136 | respond_to do |format| |
|
137 | 137 | format.html { render :action => 'new', :layout => !request.xhr? } |
|
138 | 138 | format.js { |
|
139 | 139 | render(:update) { |page| |
|
140 | 140 | if params[:project_change] |
|
141 | 141 | page.replace_html 'all_attributes', :partial => 'form' |
|
142 | 142 | else |
|
143 | 143 | page.replace_html 'attributes', :partial => 'attributes' |
|
144 | 144 | end |
|
145 | 145 | m = User.current.allowed_to?(:log_time, @issue.project) ? 'show' : 'hide' |
|
146 | 146 | page << "if ($('log_time')) {Element.#{m}('log_time');}" |
|
147 | 147 | } |
|
148 | 148 | } |
|
149 | 149 | end |
|
150 | 150 | end |
|
151 | 151 | |
|
152 | 152 | def create |
|
153 | 153 | call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue }) |
|
154 | 154 | if @issue.save |
|
155 | 155 | attachments = Attachment.attach_files(@issue, params[:attachments]) |
|
156 | 156 | call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) |
|
157 | 157 | respond_to do |format| |
|
158 | 158 | format.html { |
|
159 | 159 | render_attachment_warning_if_needed(@issue) |
|
160 | 160 | flash[:notice] = l(:notice_issue_successful_create, :id => "<a href='#{issue_path(@issue)}'>##{@issue.id}</a>") |
|
161 | 161 | redirect_to(params[:continue] ? { :action => 'new', :project_id => @issue.project, :issue => {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} } : |
|
162 | 162 | { :action => 'show', :id => @issue }) |
|
163 | 163 | } |
|
164 | 164 | format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) } |
|
165 | 165 | end |
|
166 | 166 | return |
|
167 | 167 | else |
|
168 | 168 | respond_to do |format| |
|
169 | 169 | format.html { render :action => 'new' } |
|
170 | 170 | format.api { render_validation_errors(@issue) } |
|
171 | 171 | end |
|
172 | 172 | end |
|
173 | 173 | end |
|
174 | 174 | |
|
175 | 175 | def edit |
|
176 | 176 | update_issue_from_params |
|
177 | 177 | |
|
178 | 178 | @journal = @issue.current_journal |
|
179 | 179 | |
|
180 | 180 | respond_to do |format| |
|
181 | 181 | format.html { } |
|
182 | 182 | format.xml { } |
|
183 | 183 | end |
|
184 | 184 | end |
|
185 | 185 | |
|
186 | 186 | def update |
|
187 | 187 | update_issue_from_params |
|
188 | 188 | |
|
189 | 189 | if @issue.save_issue_with_child_records(params, @time_entry) |
|
190 | 190 | render_attachment_warning_if_needed(@issue) |
|
191 | 191 | flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? |
|
192 | 192 | |
|
193 | 193 | respond_to do |format| |
|
194 | 194 | format.html { redirect_back_or_default({:action => 'show', :id => @issue}) } |
|
195 | 195 | format.api { head :ok } |
|
196 | 196 | end |
|
197 | 197 | else |
|
198 | 198 | render_attachment_warning_if_needed(@issue) |
|
199 | 199 | flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? |
|
200 | 200 | @journal = @issue.current_journal |
|
201 | 201 | |
|
202 | 202 | respond_to do |format| |
|
203 | 203 | format.html { render :action => 'edit' } |
|
204 | 204 | format.api { render_validation_errors(@issue) } |
|
205 | 205 | end |
|
206 | 206 | end |
|
207 | 207 | end |
|
208 | 208 | |
|
209 | 209 | # Bulk edit/copy a set of issues |
|
210 | 210 | def bulk_edit |
|
211 | 211 | @issues.sort! |
|
212 | 212 | @copy = params[:copy].present? |
|
213 | 213 | @notes = params[:notes] |
|
214 | 214 | |
|
215 | 215 | if User.current.allowed_to?(:move_issues, @projects) |
|
216 | 216 | @allowed_projects = Issue.allowed_target_projects_on_move |
|
217 | 217 | if params[:issue] |
|
218 | 218 | @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:issue][:project_id]} |
|
219 | 219 | if @target_project |
|
220 | 220 | target_projects = [@target_project] |
|
221 | 221 | end |
|
222 | 222 | end |
|
223 | 223 | end |
|
224 | 224 | target_projects ||= @projects |
|
225 | 225 | |
|
226 | 226 | @available_statuses = target_projects.map{|p|Workflow.available_statuses(p)}.inject{|memo,w|memo & w} |
|
227 | 227 | @custom_fields = target_projects.map{|p|p.all_issue_custom_fields}.inject{|memo,c|memo & c} |
|
228 | 228 | @assignables = target_projects.map(&:assignable_users).inject{|memo,a| memo & a} |
|
229 | 229 | @trackers = target_projects.map(&:trackers).inject{|memo,t| memo & t} |
|
230 | 230 | |
|
231 | @safe_attributes = @issues.map(&:safe_attribute_names).inject {|memo,attrs| memo & attrs} | |
|
231 | 232 | render :layout => false if request.xhr? |
|
232 | 233 | end |
|
233 | 234 | |
|
234 | 235 | def bulk_update |
|
235 | 236 | @issues.sort! |
|
236 | 237 | @copy = params[:copy].present? |
|
237 | 238 | attributes = parse_params_for_bulk_issue_attributes(params) |
|
238 | 239 | |
|
239 | 240 | unsaved_issue_ids = [] |
|
240 | 241 | moved_issues = [] |
|
241 | 242 | @issues.each do |issue| |
|
242 | 243 | issue.reload |
|
243 | 244 | if @copy |
|
244 | 245 | issue = issue.copy |
|
245 | 246 | end |
|
246 | 247 | journal = issue.init_journal(User.current, params[:notes]) |
|
247 | 248 | issue.safe_attributes = attributes |
|
248 | 249 | call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue }) |
|
249 | 250 | if issue.save |
|
250 | 251 | moved_issues << issue |
|
251 | 252 | else |
|
252 | 253 | # Keep unsaved issue ids to display them in flash error |
|
253 | 254 | unsaved_issue_ids << issue.id |
|
254 | 255 | end |
|
255 | 256 | end |
|
256 | 257 | set_flash_from_bulk_issue_save(@issues, unsaved_issue_ids) |
|
257 | 258 | |
|
258 | 259 | if params[:follow] |
|
259 | 260 | if @issues.size == 1 && moved_issues.size == 1 |
|
260 | 261 | redirect_to :controller => 'issues', :action => 'show', :id => moved_issues.first |
|
261 | 262 | elsif moved_issues.map(&:project).uniq.size == 1 |
|
262 | 263 | redirect_to :controller => 'issues', :action => 'index', :project_id => moved_issues.map(&:project).first |
|
263 | 264 | end |
|
264 | 265 | else |
|
265 | 266 | redirect_back_or_default({:controller => 'issues', :action => 'index', :project_id => @project}) |
|
266 | 267 | end |
|
267 | 268 | end |
|
268 | 269 | |
|
269 | 270 | verify :method => :delete, :only => :destroy, :render => { :nothing => true, :status => :method_not_allowed } |
|
270 | 271 | def destroy |
|
271 | 272 | @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f |
|
272 | 273 | if @hours > 0 |
|
273 | 274 | case params[:todo] |
|
274 | 275 | when 'destroy' |
|
275 | 276 | # nothing to do |
|
276 | 277 | when 'nullify' |
|
277 | 278 | TimeEntry.update_all('issue_id = NULL', ['issue_id IN (?)', @issues]) |
|
278 | 279 | when 'reassign' |
|
279 | 280 | reassign_to = @project.issues.find_by_id(params[:reassign_to_id]) |
|
280 | 281 | if reassign_to.nil? |
|
281 | 282 | flash.now[:error] = l(:error_issue_not_found_in_project) |
|
282 | 283 | return |
|
283 | 284 | else |
|
284 | 285 | TimeEntry.update_all("issue_id = #{reassign_to.id}", ['issue_id IN (?)', @issues]) |
|
285 | 286 | end |
|
286 | 287 | else |
|
287 | 288 | # display the destroy form if it's a user request |
|
288 | 289 | return unless api_request? |
|
289 | 290 | end |
|
290 | 291 | end |
|
291 | 292 | @issues.each do |issue| |
|
292 | 293 | begin |
|
293 | 294 | issue.reload.destroy |
|
294 | 295 | rescue ::ActiveRecord::RecordNotFound # raised by #reload if issue no longer exists |
|
295 | 296 | # nothing to do, issue was already deleted (eg. by a parent) |
|
296 | 297 | end |
|
297 | 298 | end |
|
298 | 299 | respond_to do |format| |
|
299 | 300 | format.html { redirect_back_or_default(:action => 'index', :project_id => @project) } |
|
300 | 301 | format.api { head :ok } |
|
301 | 302 | end |
|
302 | 303 | end |
|
303 | 304 | |
|
304 | 305 | private |
|
305 | 306 | def find_issue |
|
306 | 307 | # Issue.visible.find(...) can not be used to redirect user to the login form |
|
307 | 308 | # if the issue actually exists but requires authentication |
|
308 | 309 | @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category]) |
|
309 | 310 | unless @issue.visible? |
|
310 | 311 | deny_access |
|
311 | 312 | return |
|
312 | 313 | end |
|
313 | 314 | @project = @issue.project |
|
314 | 315 | rescue ActiveRecord::RecordNotFound |
|
315 | 316 | render_404 |
|
316 | 317 | end |
|
317 | 318 | |
|
318 | 319 | def find_project |
|
319 | 320 | project_id = params[:project_id] || (params[:issue] && params[:issue][:project_id]) |
|
320 | 321 | @project = Project.find(project_id) |
|
321 | 322 | rescue ActiveRecord::RecordNotFound |
|
322 | 323 | render_404 |
|
323 | 324 | end |
|
324 | 325 | |
|
325 | 326 | def retrieve_previous_and_next_issue_ids |
|
326 | 327 | retrieve_query_from_session |
|
327 | 328 | if @query |
|
328 | 329 | sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) |
|
329 | 330 | sort_update(@query.sortable_columns, 'issues_index_sort') |
|
330 | 331 | limit = 500 |
|
331 | 332 | issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version]) |
|
332 | 333 | if (idx = issue_ids.index(@issue.id)) && idx < limit |
|
333 | 334 | if issue_ids.size < 500 |
|
334 | 335 | @issue_position = idx + 1 |
|
335 | 336 | @issue_count = issue_ids.size |
|
336 | 337 | end |
|
337 | 338 | @prev_issue_id = issue_ids[idx - 1] if idx > 0 |
|
338 | 339 | @next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1) |
|
339 | 340 | end |
|
340 | 341 | end |
|
341 | 342 | end |
|
342 | 343 | |
|
343 | 344 | # Used by #edit and #update to set some common instance variables |
|
344 | 345 | # from the params |
|
345 | 346 | # TODO: Refactor, not everything in here is needed by #edit |
|
346 | 347 | def update_issue_from_params |
|
347 | 348 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current) |
|
348 | 349 | @priorities = IssuePriority.active |
|
349 | 350 | @edit_allowed = User.current.allowed_to?(:edit_issues, @project) |
|
350 | 351 | @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) |
|
351 | 352 | @time_entry.attributes = params[:time_entry] |
|
352 | 353 | |
|
353 | 354 | @notes = params[:notes] || (params[:issue].present? ? params[:issue][:notes] : nil) |
|
354 | 355 | @issue.init_journal(User.current, @notes) |
|
355 | 356 | @issue.safe_attributes = params[:issue] |
|
356 | 357 | end |
|
357 | 358 | |
|
358 | 359 | # TODO: Refactor, lots of extra code in here |
|
359 | 360 | # TODO: Changing tracker on an existing issue should not trigger this |
|
360 | 361 | def build_new_issue_from_params |
|
361 | 362 | if params[:id].blank? |
|
362 | 363 | @issue = Issue.new |
|
363 | 364 | if params[:copy_from] |
|
364 | 365 | begin |
|
365 | 366 | @copy_from = Issue.visible.find(params[:copy_from]) |
|
366 | 367 | @copy_attachments = params[:copy_attachments].present? || request.get? |
|
367 | 368 | @issue.copy_from(@copy_from, :attachments => @copy_attachments) |
|
368 | 369 | rescue ActiveRecord::RecordNotFound |
|
369 | 370 | render_404 |
|
370 | 371 | return |
|
371 | 372 | end |
|
372 | 373 | end |
|
373 | 374 | @issue.project = @project |
|
374 | 375 | else |
|
375 | 376 | @issue = @project.issues.visible.find(params[:id]) |
|
376 | 377 | end |
|
377 | 378 | |
|
378 | 379 | @issue.project = @project |
|
379 | 380 | @issue.author = User.current |
|
380 | 381 | # Tracker must be set before custom field values |
|
381 | 382 | @issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first) |
|
382 | 383 | if @issue.tracker.nil? |
|
383 | 384 | render_error l(:error_no_tracker_in_project) |
|
384 | 385 | return false |
|
385 | 386 | end |
|
386 | 387 | @issue.start_date ||= Date.today if Setting.default_issue_start_date_to_creation_date? |
|
387 | 388 | @issue.safe_attributes = params[:issue] |
|
388 | 389 | |
|
389 | 390 | @priorities = IssuePriority.active |
|
390 | 391 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current, true) |
|
391 | 392 | end |
|
392 | 393 | |
|
393 | 394 | def check_for_default_issue_status |
|
394 | 395 | if IssueStatus.default.nil? |
|
395 | 396 | render_error l(:error_no_default_issue_status) |
|
396 | 397 | return false |
|
397 | 398 | end |
|
398 | 399 | end |
|
399 | 400 | |
|
400 | 401 | def parse_params_for_bulk_issue_attributes(params) |
|
401 | 402 | attributes = (params[:issue] || {}).reject {|k,v| v.blank?} |
|
402 | 403 | attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'} |
|
403 | 404 | attributes[:custom_field_values].reject! {|k,v| v.blank?} if attributes[:custom_field_values] |
|
404 | 405 | attributes |
|
405 | 406 | end |
|
406 | 407 | end |
@@ -1,117 +1,125 | |||
|
1 | 1 | <h2><%= @copy ? l(:button_copy) : l(:label_bulk_edit_selected_issues) %></h2> |
|
2 | 2 | |
|
3 | 3 | <ul><%= @issues.collect {|i| |
|
4 | 4 | content_tag('li', |
|
5 | 5 | link_to(h("#{i.tracker} ##{i.id}"), |
|
6 | 6 | { :action => 'show', :id => i } |
|
7 | 7 | ) + h(": #{i.subject}")) |
|
8 | 8 | }.join("\n").html_safe %></ul> |
|
9 | 9 | |
|
10 | 10 | <% form_tag({:action => 'bulk_update'}, :id => 'bulk_edit_form') do %> |
|
11 | 11 | <%= @issues.collect {|i| hidden_field_tag('ids[]', i.id)}.join("\n").html_safe %> |
|
12 | 12 | <div class="box tabular"> |
|
13 | 13 | <fieldset class="attributes"> |
|
14 | 14 | <legend><%= l(:label_change_properties) %></legend> |
|
15 | 15 | |
|
16 | 16 | <div class="splitcontentleft"> |
|
17 | 17 | <% if @allowed_projects.present? %> |
|
18 | 18 | <p> |
|
19 | 19 | <label for="issue_project_id"><%= l(:field_project) %></label> |
|
20 | 20 | <%= select_tag('issue[project_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>" + project_tree_options_for_select(@allowed_projects, :selected => @target_project)) %> |
|
21 | 21 | </p> |
|
22 | 22 | <%= observe_field :issue_project_id, :url => {:action => 'bulk_edit'}, |
|
23 | 23 | :update => 'content', |
|
24 | 24 | :with => "Form.serialize('bulk_edit_form')" %> |
|
25 | 25 | <% end %> |
|
26 | 26 | <p> |
|
27 | 27 | <label for="issue_tracker_id"><%= l(:field_tracker) %></label> |
|
28 | 28 | <%= select_tag('issue[tracker_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@trackers, :id, :name)) %> |
|
29 | 29 | </p> |
|
30 | 30 | <% if @available_statuses.any? %> |
|
31 | 31 | <p> |
|
32 | 32 | <label for='issue_status_id'><%= l(:field_status) %></label> |
|
33 | 33 | <%= select_tag('issue[status_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@available_statuses, :id, :name)) %> |
|
34 | 34 | </p> |
|
35 | 35 | <% end %> |
|
36 | 36 | <p> |
|
37 | 37 | <label for='issue_priority_id'><%= l(:field_priority) %></label> |
|
38 | 38 | <%= select_tag('issue[priority_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(IssuePriority.active, :id, :name)) %> |
|
39 | 39 | </p> |
|
40 | 40 | <p> |
|
41 | 41 | <label for='issue_assigned_to_id'><%= l(:field_assigned_to) %></label> |
|
42 | 42 | <%= select_tag('issue[assigned_to_id]', content_tag('option', l(:label_no_change_option), :value => '') + |
|
43 | 43 | content_tag('option', l(:label_nobody), :value => 'none') + |
|
44 | 44 | principals_options_for_select(@assignables)) %> |
|
45 | 45 | </p> |
|
46 | 46 | <% if @project %> |
|
47 | 47 | <p> |
|
48 | 48 | <label for='issue_category_id'><%= l(:field_category) %></label> |
|
49 | 49 | <%= select_tag('issue[category_id]', content_tag('option', l(:label_no_change_option), :value => '') + |
|
50 | 50 | content_tag('option', l(:label_none), :value => 'none') + |
|
51 | 51 | options_from_collection_for_select(@project.issue_categories, :id, :name)) %> |
|
52 | 52 | </p> |
|
53 | 53 | <% end %> |
|
54 | 54 | <% #TODO: allow editing versions when multiple projects %> |
|
55 | 55 | <% if @project %> |
|
56 | 56 | <p> |
|
57 | 57 | <label for='issue_fixed_version_id'><%= l(:field_fixed_version) %></label> |
|
58 | 58 | <%= select_tag('issue[fixed_version_id]', content_tag('option', l(:label_no_change_option), :value => '') + |
|
59 | 59 | content_tag('option', l(:label_none), :value => 'none') + |
|
60 | 60 | version_options_for_select(@project.shared_versions.open.sort)) %> |
|
61 | 61 | </p> |
|
62 | 62 | <% end %> |
|
63 | 63 | |
|
64 | 64 | <% @custom_fields.each do |custom_field| %> |
|
65 | 65 | <p><label><%= h(custom_field.name) %></label> <%= custom_field_tag_for_bulk_edit('issue', custom_field, @projects) %></p> |
|
66 | 66 | <% end %> |
|
67 | 67 | |
|
68 | 68 | <%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %> |
|
69 | 69 | </div> |
|
70 | 70 | |
|
71 | 71 | <div class="splitcontentright"> |
|
72 | <% if @safe_attributes.include?('is_private') %> | |
|
73 | <p> | |
|
74 | <label for='issue_is_private'><%= l(:field_is_private) %></label> | |
|
75 | <%= select_tag('issue[is_private]', content_tag('option', l(:label_no_change_option), :value => '') + | |
|
76 | content_tag('option', l(:general_text_Yes), :value => '1') + | |
|
77 | content_tag('option', l(:general_text_No), :value => '0')) %> | |
|
78 | </p> | |
|
79 | <% end %> | |
|
72 | 80 | <% if @project && User.current.allowed_to?(:manage_subtasks, @project) %> |
|
73 | 81 | <p> |
|
74 | 82 | <label for='issue_parent_issue_id'><%= l(:field_parent_issue) %></label> |
|
75 | 83 | <%= text_field_tag 'issue[parent_issue_id]', '', :size => 10 %> |
|
76 | 84 | </p> |
|
77 | 85 | <div id="parent_issue_candidates" class="autocomplete"></div> |
|
78 | 86 | <%= javascript_tag "observeParentIssueField('#{auto_complete_issues_path(:project_id => @project) }')" %> |
|
79 | 87 | <% end %> |
|
80 | 88 | <p> |
|
81 | 89 | <label for='issue_start_date'><%= l(:field_start_date) %></label> |
|
82 | 90 | <%= text_field_tag 'issue[start_date]', '', :size => 10 %><%= calendar_for('issue_start_date') %> |
|
83 | 91 | </p> |
|
84 | 92 | <p> |
|
85 | 93 | <label for='issue_due_date'><%= l(:field_due_date) %></label> |
|
86 | 94 | <%= text_field_tag 'issue[due_date]', '', :size => 10 %><%= calendar_for('issue_due_date') %> |
|
87 | 95 | </p> |
|
88 | 96 | <% if Issue.use_field_for_done_ratio? %> |
|
89 | 97 | <p> |
|
90 | 98 | <label for='issue_done_ratio'><%= l(:field_done_ratio) %></label> |
|
91 | 99 | <%= select_tag 'issue[done_ratio]', options_for_select([[l(:label_no_change_option), '']] + (0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %> |
|
92 | 100 | </p> |
|
93 | 101 | <% end %> |
|
94 | 102 | </div> |
|
95 | 103 | |
|
96 | 104 | </fieldset> |
|
97 | 105 | |
|
98 | 106 | <fieldset><legend><%= l(:field_notes) %></legend> |
|
99 | 107 | <%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %> |
|
100 | 108 | <%= wikitoolbar_for 'notes' %> |
|
101 | 109 | </fieldset> |
|
102 | 110 | </div> |
|
103 | 111 | |
|
104 | 112 | <p> |
|
105 | 113 | <% if @copy %> |
|
106 | 114 | <%= hidden_field_tag 'copy', '1' %> |
|
107 | 115 | <%= submit_tag l(:button_copy) %> |
|
108 | 116 | <%= submit_tag l(:button_copy_and_follow), :name => 'follow' %> |
|
109 | 117 | <% elsif @target_project %> |
|
110 | 118 | <%= submit_tag l(:button_move) %> |
|
111 | 119 | <%= submit_tag l(:button_move_and_follow), :name => 'follow' %> |
|
112 | 120 | <% else %> |
|
113 | 121 | <%= submit_tag l(:button_submit) %> |
|
114 | 122 | <% end %> |
|
115 | 123 | </p> |
|
116 | 124 | |
|
117 | 125 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now