##// END OF EJS Templates
Merged r16292 (#20661)....
Jean-Philippe Lang -
r15926:0f9966aadf86
parent child
Show More
@@ -1,529 +1,534
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2016 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, :destroy]
24 24 before_filter :authorize, :except => [:index, :new, :create]
25 25 before_filter :find_optional_project, :only => [:index, :new, :create]
26 26 before_filter :build_new_issue_from_params, :only => [:new, :create]
27 27 accept_rss_auth :index, :show
28 28 accept_api_auth :index, :show, :create, :update, :destroy
29 29
30 30 rescue_from Query::StatementInvalid, :with => :query_statement_invalid
31 31
32 32 helper :journals
33 33 helper :projects
34 34 helper :custom_fields
35 35 helper :issue_relations
36 36 helper :watchers
37 37 helper :attachments
38 38 helper :queries
39 39 include QueriesHelper
40 40 helper :repositories
41 41 helper :sort
42 42 include SortHelper
43 43 helper :timelog
44 44
45 45 def index
46 46 retrieve_query
47 47 sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
48 48 sort_update(@query.sortable_columns)
49 49 @query.sort_criteria = sort_criteria.to_a
50 50
51 51 if @query.valid?
52 52 case params[:format]
53 53 when 'csv', 'pdf'
54 54 @limit = Setting.issues_export_limit.to_i
55 55 if params[:columns] == 'all'
56 56 @query.column_names = @query.available_inline_columns.map(&:name)
57 57 end
58 58 when 'atom'
59 59 @limit = Setting.feeds_limit.to_i
60 60 when 'xml', 'json'
61 61 @offset, @limit = api_offset_and_limit
62 62 @query.column_names = %w(author)
63 63 else
64 64 @limit = per_page_option
65 65 end
66 66
67 67 @issue_count = @query.issue_count
68 68 @issue_pages = Paginator.new @issue_count, @limit, params['page']
69 69 @offset ||= @issue_pages.offset
70 70 @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
71 71 :order => sort_clause,
72 72 :offset => @offset,
73 73 :limit => @limit)
74 74 @issue_count_by_group = @query.issue_count_by_group
75 75
76 76 respond_to do |format|
77 77 format.html { render :template => 'issues/index', :layout => !request.xhr? }
78 78 format.api {
79 79 Issue.load_visible_relations(@issues) if include_in_api_response?('relations')
80 80 }
81 81 format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") }
82 82 format.csv { send_data(query_to_csv(@issues, @query, params[:csv]), :type => 'text/csv; header=present', :filename => 'issues.csv') }
83 83 format.pdf { send_file_headers! :type => 'application/pdf', :filename => 'issues.pdf' }
84 84 end
85 85 else
86 86 respond_to do |format|
87 87 format.html { render(:template => 'issues/index', :layout => !request.xhr?) }
88 88 format.any(:atom, :csv, :pdf) { render(:nothing => true) }
89 89 format.api { render_validation_errors(@query) }
90 90 end
91 91 end
92 92 rescue ActiveRecord::RecordNotFound
93 93 render_404
94 94 end
95 95
96 96 def show
97 97 @journals = @issue.journals.includes(:user, :details).
98 98 references(:user, :details).
99 99 reorder(:created_on, :id).to_a
100 100 @journals.each_with_index {|j,i| j.indice = i+1}
101 101 @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
102 102 Journal.preload_journals_details_custom_fields(@journals)
103 103 @journals.select! {|journal| journal.notes? || journal.visible_details.any?}
104 104 @journals.reverse! if User.current.wants_comments_in_reverse_order?
105 105
106 106 @changesets = @issue.changesets.visible.preload(:repository, :user).to_a
107 107 @changesets.reverse! if User.current.wants_comments_in_reverse_order?
108 108
109 109 @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
110 110 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
111 111 @priorities = IssuePriority.active
112 112 @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
113 113 @relation = IssueRelation.new
114 114
115 if User.current.allowed_to?(:view_time_entries, @project)
116 Issue.load_visible_spent_hours([@issue])
117 Issue.load_visible_total_spent_hours([@issue])
118 end
119
115 120 respond_to do |format|
116 121 format.html {
117 122 retrieve_previous_and_next_issue_ids
118 123 render :template => 'issues/show'
119 124 }
120 125 format.api
121 126 format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
122 127 format.pdf {
123 128 send_file_headers! :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf"
124 129 }
125 130 end
126 131 end
127 132
128 133 def new
129 134 respond_to do |format|
130 135 format.html { render :action => 'new', :layout => !request.xhr? }
131 136 format.js
132 137 end
133 138 end
134 139
135 140 def create
136 141 unless User.current.allowed_to?(:add_issues, @issue.project, :global => true)
137 142 raise ::Unauthorized
138 143 end
139 144 call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
140 145 @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
141 146 if @issue.save
142 147 call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
143 148 respond_to do |format|
144 149 format.html {
145 150 render_attachment_warning_if_needed(@issue)
146 151 flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("##{@issue.id}", issue_path(@issue), :title => @issue.subject))
147 152 redirect_after_create
148 153 }
149 154 format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) }
150 155 end
151 156 return
152 157 else
153 158 respond_to do |format|
154 159 format.html {
155 160 if @issue.project.nil?
156 161 render_error :status => 422
157 162 else
158 163 render :action => 'new'
159 164 end
160 165 }
161 166 format.api { render_validation_errors(@issue) }
162 167 end
163 168 end
164 169 end
165 170
166 171 def edit
167 172 return unless update_issue_from_params
168 173
169 174 respond_to do |format|
170 175 format.html { }
171 176 format.js
172 177 end
173 178 end
174 179
175 180 def update
176 181 return unless update_issue_from_params
177 182 @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
178 183 saved = false
179 184 begin
180 185 saved = save_issue_with_child_records
181 186 rescue ActiveRecord::StaleObjectError
182 187 @conflict = true
183 188 if params[:last_journal_id]
184 189 @conflict_journals = @issue.journals_after(params[:last_journal_id]).to_a
185 190 @conflict_journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
186 191 end
187 192 end
188 193
189 194 if saved
190 195 render_attachment_warning_if_needed(@issue)
191 196 flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record?
192 197
193 198 respond_to do |format|
194 199 format.html { redirect_back_or_default issue_path(@issue) }
195 200 format.api { render_api_ok }
196 201 end
197 202 else
198 203 respond_to do |format|
199 204 format.html { render :action => 'edit' }
200 205 format.api { render_validation_errors(@issue) }
201 206 end
202 207 end
203 208 end
204 209
205 210 # Bulk edit/copy a set of issues
206 211 def bulk_edit
207 212 @issues.sort!
208 213 @copy = params[:copy].present?
209 214 @notes = params[:notes]
210 215
211 216 if @copy
212 217 unless User.current.allowed_to?(:copy_issues, @projects)
213 218 raise ::Unauthorized
214 219 end
215 220 end
216 221
217 222 @allowed_projects = Issue.allowed_target_projects
218 223 if params[:issue]
219 224 @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:issue][:project_id].to_s}
220 225 if @target_project
221 226 target_projects = [@target_project]
222 227 end
223 228 end
224 229 target_projects ||= @projects
225 230
226 231 if @copy
227 232 # Copied issues will get their default statuses
228 233 @available_statuses = []
229 234 else
230 235 @available_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
231 236 end
232 237 @custom_fields = @issues.map{|i|i.editable_custom_fields}.reduce(:&)
233 238 @assignables = target_projects.map(&:assignable_users).reduce(:&)
234 239 @trackers = target_projects.map(&:trackers).reduce(:&)
235 240 @versions = target_projects.map {|p| p.shared_versions.open}.reduce(:&)
236 241 @categories = target_projects.map {|p| p.issue_categories}.reduce(:&)
237 242 if @copy
238 243 @attachments_present = @issues.detect {|i| i.attachments.any?}.present?
239 244 @subtasks_present = @issues.detect {|i| !i.leaf?}.present?
240 245 end
241 246
242 247 @safe_attributes = @issues.map(&:safe_attribute_names).reduce(:&)
243 248
244 249 @issue_params = params[:issue] || {}
245 250 @issue_params[:custom_field_values] ||= {}
246 251 end
247 252
248 253 def bulk_update
249 254 @issues.sort!
250 255 @copy = params[:copy].present?
251 256
252 257 attributes = parse_params_for_bulk_issue_attributes(params)
253 258 copy_subtasks = (params[:copy_subtasks] == '1')
254 259 copy_attachments = (params[:copy_attachments] == '1')
255 260
256 261 if @copy
257 262 unless User.current.allowed_to?(:copy_issues, @projects)
258 263 raise ::Unauthorized
259 264 end
260 265 target_projects = @projects
261 266 if attributes['project_id'].present?
262 267 target_projects = Project.where(:id => attributes['project_id']).to_a
263 268 end
264 269 unless User.current.allowed_to?(:add_issues, target_projects)
265 270 raise ::Unauthorized
266 271 end
267 272 end
268 273
269 274 unsaved_issues = []
270 275 saved_issues = []
271 276
272 277 if @copy && copy_subtasks
273 278 # Descendant issues will be copied with the parent task
274 279 # Don't copy them twice
275 280 @issues.reject! {|issue| @issues.detect {|other| issue.is_descendant_of?(other)}}
276 281 end
277 282
278 283 @issues.each do |orig_issue|
279 284 orig_issue.reload
280 285 if @copy
281 286 issue = orig_issue.copy({},
282 287 :attachments => copy_attachments,
283 288 :subtasks => copy_subtasks,
284 289 :link => link_copy?(params[:link_copy])
285 290 )
286 291 else
287 292 issue = orig_issue
288 293 end
289 294 journal = issue.init_journal(User.current, params[:notes])
290 295 issue.safe_attributes = attributes
291 296 call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue })
292 297 if issue.save
293 298 saved_issues << issue
294 299 else
295 300 unsaved_issues << orig_issue
296 301 end
297 302 end
298 303
299 304 if unsaved_issues.empty?
300 305 flash[:notice] = l(:notice_successful_update) unless saved_issues.empty?
301 306 if params[:follow]
302 307 if @issues.size == 1 && saved_issues.size == 1
303 308 redirect_to issue_path(saved_issues.first)
304 309 elsif saved_issues.map(&:project).uniq.size == 1
305 310 redirect_to project_issues_path(saved_issues.map(&:project).first)
306 311 end
307 312 else
308 313 redirect_back_or_default _project_issues_path(@project)
309 314 end
310 315 else
311 316 @saved_issues = @issues
312 317 @unsaved_issues = unsaved_issues
313 318 @issues = Issue.visible.where(:id => @unsaved_issues.map(&:id)).to_a
314 319 bulk_edit
315 320 render :action => 'bulk_edit'
316 321 end
317 322 end
318 323
319 324 def destroy
320 325
321 326 # all issues and their descendants are about to be deleted
322 327 issues_and_descendants_ids = Issue.self_and_descendants(@issues).pluck(:id)
323 328 time_entries = TimeEntry.where(:issue_id => issues_and_descendants_ids)
324 329 @hours = time_entries.sum(:hours).to_f
325 330
326 331 if @hours > 0
327 332 case params[:todo]
328 333 when 'destroy'
329 334 # nothing to do
330 335 when 'nullify'
331 336 time_entries.update_all(:issue_id => nil)
332 337 when 'reassign'
333 338 reassign_to = @project && @project.issues.find_by_id(params[:reassign_to_id])
334 339 if reassign_to.nil?
335 340 flash.now[:error] = l(:error_issue_not_found_in_project)
336 341 return
337 342 elsif issues_and_descendants_ids.include?(reassign_to.id)
338 343 flash.now[:error] = l(:error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted)
339 344 return
340 345 else
341 346 time_entries.update_all(:issue_id => reassign_to.id, :project_id => reassign_to.project_id)
342 347 end
343 348 else
344 349 # display the destroy form if it's a user request
345 350 return unless api_request?
346 351 end
347 352 end
348 353 @issues.each do |issue|
349 354 begin
350 355 issue.reload.destroy
351 356 rescue ::ActiveRecord::RecordNotFound # raised by #reload if issue no longer exists
352 357 # nothing to do, issue was already deleted (eg. by a parent)
353 358 end
354 359 end
355 360 respond_to do |format|
356 361 format.html { redirect_back_or_default _project_issues_path(@project) }
357 362 format.api { render_api_ok }
358 363 end
359 364 end
360 365
361 366 private
362 367
363 368 def retrieve_previous_and_next_issue_ids
364 369 retrieve_query_from_session
365 370 if @query
366 371 sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
367 372 sort_update(@query.sortable_columns, 'issues_index_sort')
368 373 limit = 500
369 374 issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version])
370 375 if (idx = issue_ids.index(@issue.id)) && idx < limit
371 376 if issue_ids.size < 500
372 377 @issue_position = idx + 1
373 378 @issue_count = issue_ids.size
374 379 end
375 380 @prev_issue_id = issue_ids[idx - 1] if idx > 0
376 381 @next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1)
377 382 end
378 383 end
379 384 end
380 385
381 386 # Used by #edit and #update to set some common instance variables
382 387 # from the params
383 388 def update_issue_from_params
384 389 @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
385 390 if params[:time_entry]
386 391 @time_entry.safe_attributes = params[:time_entry]
387 392 end
388 393
389 394 @issue.init_journal(User.current)
390 395
391 396 issue_attributes = params[:issue]
392 397 if issue_attributes && params[:conflict_resolution]
393 398 case params[:conflict_resolution]
394 399 when 'overwrite'
395 400 issue_attributes = issue_attributes.dup
396 401 issue_attributes.delete(:lock_version)
397 402 when 'add_notes'
398 403 issue_attributes = issue_attributes.slice(:notes, :private_notes)
399 404 when 'cancel'
400 405 redirect_to issue_path(@issue)
401 406 return false
402 407 end
403 408 end
404 409 @issue.safe_attributes = issue_attributes
405 410 @priorities = IssuePriority.active
406 411 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
407 412 true
408 413 end
409 414
410 415 # Used by #new and #create to build a new issue from the params
411 416 # The new issue will be copied from an existing one if copy_from parameter is given
412 417 def build_new_issue_from_params
413 418 @issue = Issue.new
414 419 if params[:copy_from]
415 420 begin
416 421 @issue.init_journal(User.current)
417 422 @copy_from = Issue.visible.find(params[:copy_from])
418 423 unless User.current.allowed_to?(:copy_issues, @copy_from.project)
419 424 raise ::Unauthorized
420 425 end
421 426 @link_copy = link_copy?(params[:link_copy]) || request.get?
422 427 @copy_attachments = params[:copy_attachments].present? || request.get?
423 428 @copy_subtasks = params[:copy_subtasks].present? || request.get?
424 429 @issue.copy_from(@copy_from, :attachments => @copy_attachments, :subtasks => @copy_subtasks, :link => @link_copy)
425 430 rescue ActiveRecord::RecordNotFound
426 431 render_404
427 432 return
428 433 end
429 434 end
430 435 @issue.project = @project
431 436 if request.get?
432 437 @issue.project ||= @issue.allowed_target_projects.first
433 438 end
434 439 @issue.author ||= User.current
435 440 @issue.start_date ||= Date.today if Setting.default_issue_start_date_to_creation_date?
436 441
437 442 attrs = (params[:issue] || {}).deep_dup
438 443 if action_name == 'new' && params[:was_default_status] == attrs[:status_id]
439 444 attrs.delete(:status_id)
440 445 end
441 446 if action_name == 'new' && params[:form_update_triggered_by] == 'issue_project_id'
442 447 # Discard submitted version when changing the project on the issue form
443 448 # so we can use the default version for the new project
444 449 attrs.delete(:fixed_version_id)
445 450 end
446 451 @issue.safe_attributes = attrs
447 452
448 453 if @issue.project
449 454 @issue.tracker ||= @issue.project.trackers.first
450 455 if @issue.tracker.nil?
451 456 render_error l(:error_no_tracker_in_project)
452 457 return false
453 458 end
454 459 if @issue.status.nil?
455 460 render_error l(:error_no_default_issue_status)
456 461 return false
457 462 end
458 463 end
459 464
460 465 @priorities = IssuePriority.active
461 466 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
462 467 end
463 468
464 469 def parse_params_for_bulk_issue_attributes(params)
465 470 attributes = (params[:issue] || {}).reject {|k,v| v.blank?}
466 471 attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
467 472 if custom = attributes[:custom_field_values]
468 473 custom.reject! {|k,v| v.blank?}
469 474 custom.keys.each do |k|
470 475 if custom[k].is_a?(Array)
471 476 custom[k] << '' if custom[k].delete('__none__')
472 477 else
473 478 custom[k] = '' if custom[k] == '__none__'
474 479 end
475 480 end
476 481 end
477 482 attributes
478 483 end
479 484
480 485 # Saves @issue and a time_entry from the parameters
481 486 def save_issue_with_child_records
482 487 Issue.transaction do
483 488 if params[:time_entry] && (params[:time_entry][:hours].present? || params[:time_entry][:comments].present?) && User.current.allowed_to?(:log_time, @issue.project)
484 489 time_entry = @time_entry || TimeEntry.new
485 490 time_entry.project = @issue.project
486 491 time_entry.issue = @issue
487 492 time_entry.user = User.current
488 493 time_entry.spent_on = User.current.today
489 494 time_entry.attributes = params[:time_entry]
490 495 @issue.time_entries << time_entry
491 496 end
492 497
493 498 call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => time_entry, :journal => @issue.current_journal})
494 499 if @issue.save
495 500 call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => time_entry, :journal => @issue.current_journal})
496 501 else
497 502 raise ActiveRecord::Rollback
498 503 end
499 504 end
500 505 end
501 506
502 507 # Returns true if the issue copy should be linked
503 508 # to the original issue
504 509 def link_copy?(param)
505 510 case Setting.link_copied_issue
506 511 when 'yes'
507 512 true
508 513 when 'no'
509 514 false
510 515 when 'ask'
511 516 param == '1'
512 517 end
513 518 end
514 519
515 520 # Redirects user after a successful issue creation
516 521 def redirect_after_create
517 522 if params[:continue]
518 523 attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?}
519 524 if params[:project_id]
520 525 redirect_to new_project_issue_path(@issue.project, :issue => attrs)
521 526 else
522 527 attrs.merge! :project_id => @issue.project_id
523 528 redirect_to new_issue_path(:issue => attrs)
524 529 end
525 530 else
526 531 redirect_to issue_path(@issue)
527 532 end
528 533 end
529 534 end
@@ -1,162 +1,162
1 1 <%= render :partial => 'action_menu' %>
2 2
3 3 <h2><%= issue_heading(@issue) %></h2>
4 4
5 5 <div class="<%= @issue.css_classes %> details">
6 6 <% if @prev_issue_id || @next_issue_id %>
7 7 <div class="next-prev-links contextual">
8 8 <%= link_to_if @prev_issue_id,
9 9 "\xc2\xab #{l(:label_previous)}",
10 10 (@prev_issue_id ? issue_path(@prev_issue_id) : nil),
11 11 :title => "##{@prev_issue_id}",
12 12 :accesskey => accesskey(:previous) %> |
13 13 <% if @issue_position && @issue_count %>
14 14 <span class="position"><%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %></span> |
15 15 <% end %>
16 16 <%= link_to_if @next_issue_id,
17 17 "#{l(:label_next)} \xc2\xbb",
18 18 (@next_issue_id ? issue_path(@next_issue_id) : nil),
19 19 :title => "##{@next_issue_id}",
20 20 :accesskey => accesskey(:next) %>
21 21 </div>
22 22 <% end %>
23 23
24 24 <%= avatar(@issue.author, :size => "50") %>
25 25
26 26 <div class="subject">
27 27 <%= render_issue_subject_with_tree(@issue) %>
28 28 </div>
29 29 <p class="author">
30 30 <%= authoring @issue.created_on, @issue.author %>.
31 31 <% if @issue.created_on != @issue.updated_on %>
32 32 <%= l(:label_updated_time, time_tag(@issue.updated_on)).html_safe %>.
33 33 <% end %>
34 34 </p>
35 35
36 36 <div class="attributes">
37 37 <%= issue_fields_rows do |rows|
38 38 rows.left l(:field_status), @issue.status.name, :class => 'status'
39 39 rows.left l(:field_priority), @issue.priority.name, :class => 'priority'
40 40
41 41 unless @issue.disabled_core_fields.include?('assigned_to_id')
42 42 rows.left l(:field_assigned_to), avatar(@issue.assigned_to, :size => "14").to_s.html_safe + (@issue.assigned_to ? link_to_user(@issue.assigned_to) : "-"), :class => 'assigned-to'
43 43 end
44 44 unless @issue.disabled_core_fields.include?('category_id') || (@issue.category.nil? && @issue.project.issue_categories.none?)
45 45 rows.left l(:field_category), (@issue.category ? @issue.category.name : "-"), :class => 'category'
46 46 end
47 47 unless @issue.disabled_core_fields.include?('fixed_version_id') || (@issue.fixed_version.nil? && @issue.assignable_versions.none?)
48 48 rows.left l(:field_fixed_version), (@issue.fixed_version ? link_to_version(@issue.fixed_version) : "-"), :class => 'fixed-version'
49 49 end
50 50
51 51 unless @issue.disabled_core_fields.include?('start_date')
52 52 rows.right l(:field_start_date), format_date(@issue.start_date), :class => 'start-date'
53 53 end
54 54 unless @issue.disabled_core_fields.include?('due_date')
55 55 rows.right l(:field_due_date), format_date(@issue.due_date), :class => 'due-date'
56 56 end
57 57 unless @issue.disabled_core_fields.include?('done_ratio')
58 58 rows.right l(:field_done_ratio), progress_bar(@issue.done_ratio, :legend => "#{@issue.done_ratio}%"), :class => 'progress'
59 59 end
60 60 unless @issue.disabled_core_fields.include?('estimated_hours')
61 61 if @issue.estimated_hours.present? || @issue.total_estimated_hours.to_f > 0
62 62 rows.right l(:field_estimated_hours), issue_estimated_hours_details(@issue), :class => 'estimated-hours'
63 63 end
64 64 end
65 if User.current.allowed_to_view_all_time_entries?(@project)
65 if User.current.allowed_to?(:view_time_entries, @project)
66 66 if @issue.total_spent_hours > 0
67 67 rows.right l(:label_spent_time), issue_spent_hours_details(@issue), :class => 'spent-time'
68 68 end
69 69 end
70 70 end %>
71 71 <%= render_custom_fields_rows(@issue) %>
72 72 <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
73 73 </div>
74 74
75 75 <% if @issue.description? || @issue.attachments.any? -%>
76 76 <hr />
77 77 <% if @issue.description? %>
78 78 <div class="description">
79 79 <div class="contextual">
80 80 <%= link_to l(:button_quote), quoted_issue_path(@issue), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %>
81 81 </div>
82 82
83 83 <p><strong><%=l(:field_description)%></strong></p>
84 84 <div class="wiki">
85 85 <%= textilizable @issue, :description, :attachments => @issue.attachments %>
86 86 </div>
87 87 </div>
88 88 <% end %>
89 89 <%= link_to_attachments @issue, :thumbnails => true %>
90 90 <% end -%>
91 91
92 92 <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %>
93 93
94 94 <% if !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %>
95 95 <hr />
96 96 <div id="issue_tree">
97 97 <div class="contextual">
98 98 <%= link_to_new_subtask(@issue) if User.current.allowed_to?(:manage_subtasks, @project) %>
99 99 </div>
100 100 <p><strong><%=l(:label_subtask_plural)%></strong></p>
101 101 <%= render_descendants_tree(@issue) unless @issue.leaf? %>
102 102 </div>
103 103 <% end %>
104 104
105 105 <% if @relations.present? || User.current.allowed_to?(:manage_issue_relations, @project) %>
106 106 <hr />
107 107 <div id="relations">
108 108 <%= render :partial => 'relations' %>
109 109 </div>
110 110 <% end %>
111 111
112 112 </div>
113 113
114 114 <% if @changesets.present? %>
115 115 <div id="issue-changesets">
116 116 <h3><%=l(:label_associated_revisions)%></h3>
117 117 <%= render :partial => 'changesets', :locals => { :changesets => @changesets} %>
118 118 </div>
119 119 <% end %>
120 120
121 121 <% if @journals.present? %>
122 122 <div id="history">
123 123 <h3><%=l(:label_history)%></h3>
124 124 <%= render :partial => 'history', :locals => { :issue => @issue, :journals => @journals } %>
125 125 </div>
126 126 <% end %>
127 127
128 128
129 129 <div style="clear: both;"></div>
130 130 <%= render :partial => 'action_menu' %>
131 131
132 132 <div style="clear: both;"></div>
133 133 <% if @issue.editable? %>
134 134 <div id="update" style="display:none;">
135 135 <h3><%= l(:button_edit) %></h3>
136 136 <%= render :partial => 'edit' %>
137 137 </div>
138 138 <% end %>
139 139
140 140 <% other_formats_links do |f| %>
141 141 <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
142 142 <%= f.link_to 'PDF' %>
143 143 <% end %>
144 144
145 145 <% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %>
146 146
147 147 <% content_for :sidebar do %>
148 148 <%= render :partial => 'issues/sidebar' %>
149 149
150 150 <% if User.current.allowed_to?(:add_issue_watchers, @project) ||
151 151 (@issue.watchers.present? && User.current.allowed_to?(:view_issue_watchers, @project)) %>
152 152 <div id="watchers">
153 153 <%= render :partial => 'watchers/watchers', :locals => {:watched => @issue} %>
154 154 </div>
155 155 <% end %>
156 156 <% end %>
157 157
158 158 <% content_for :header_tags do %>
159 159 <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %>
160 160 <% end %>
161 161
162 162 <%= context_menu issues_context_menu_path %>
General Comments 0
You need to be logged in to leave comments. Login now