##// END OF EJS Templates
Added Issue#attributes_editable?...
Jean-Philippe Lang -
r13614:37aa01674039
parent child
Show More
@@ -116,7 +116,6 class IssuesController < ApplicationController
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 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
120 119 @priorities = IssuePriority.active
121 120 @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
122 121 @relation = IssueRelation.new
@@ -393,7 +392,6 class IssuesController < ApplicationController
393 392 # from the params
394 393 # TODO: Refactor, not everything in here is needed by #edit
395 394 def update_issue_from_params
396 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
397 395 @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
398 396 if params[:time_entry]
399 397 @time_entry.attributes = params[:time_entry]
@@ -153,7 +153,12 class Issue < ActiveRecord::Base
153 153
154 154 # Returns true if user or current user is allowed to edit or add a note to the issue
155 155 def editable?(user=User.current)
156 user.allowed_to?(:edit_issues, project) || user.allowed_to?(:add_issue_notes, project)
156 attributes_editable?(user) || user.allowed_to?(:add_issue_notes, project)
157 end
158
159 # Returns true if user or current user is allowed to edit the issue
160 def attributes_editable?(user=User.current)
161 user.allowed_to?(:edit_issues, project)
157 162 end
158 163
159 164 def initialize(attributes=nil, *args)
@@ -2,7 +2,7
2 2 <%= error_messages_for 'issue', 'time_entry' %>
3 3 <%= render :partial => 'conflict' if @conflict %>
4 4 <div class="box">
5 <% if @edit_allowed %>
5 <% if @issue.attributes_editable? %>
6 6 <fieldset class="tabular"><legend><%= l(:label_change_properties) %></legend>
7 7 <div id="all_attributes">
8 8 <%= render :partial => 'form', :locals => {:f => f} %>
General Comments 0
You need to be logged in to leave comments. Login now