@relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
- @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
@priorities = IssuePriority.active
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
@relation = IssueRelation.new
# from the params
# TODO: Refactor, not everything in here is needed by #edit
def update_issue_from_params
- @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
if params[:time_entry]
@time_entry.attributes = params[:time_entry]
# Returns true if user or current user is allowed to edit or add a note to the issue
def editable?(user=User.current)
- user.allowed_to?(:edit_issues, project) || user.allowed_to?(:add_issue_notes, project)
+ attributes_editable?(user) || user.allowed_to?(:add_issue_notes, project)
+ end
+
+ # Returns true if user or current user is allowed to edit the issue
+ def attributes_editable?(user=User.current)
+ user.allowed_to?(:edit_issues, project)
end
def initialize(attributes=nil, *args)
<%= error_messages_for 'issue', 'time_entry' %>
<%= render :partial => 'conflict' if @conflict %>
<div class="box">
- <% if @edit_allowed %>
+ <% if @issue.attributes_editable? %>
<fieldset class="tabular"><legend><%= l(:label_change_properties) %></legend>
<div id="all_attributes">
<%= render :partial => 'form', :locals => {:f => f} %>