Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8826 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
07a93c2731
commit
8b3ed4175d
|
@ -4,17 +4,11 @@ class ContextMenusController < ApplicationController
|
||||||
|
|
||||||
def issues
|
def issues
|
||||||
@issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project)
|
@issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project)
|
||||||
|
|
||||||
if (@issues.size == 1)
|
if (@issues.size == 1)
|
||||||
@issue = @issues.first
|
@issue = @issues.first
|
||||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
|
||||||
else
|
|
||||||
@allowed_statuses = @issues.map do |i|
|
|
||||||
i.new_statuses_allowed_to(User.current)
|
|
||||||
end.inject do |memo,s|
|
|
||||||
memo & s
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@allowed_statuses = @issues.map(&:new_statuses_allowed_to).inject{|memo,a| memo & a}
|
||||||
@projects = @issues.collect(&:project).compact.uniq
|
@projects = @issues.collect(&:project).compact.uniq
|
||||||
@project = @projects.first if @projects.size == 1
|
@project = @projects.first if @projects.size == 1
|
||||||
|
|
||||||
|
|
|
@ -510,7 +510,7 @@ class Issue < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns an array of status that user is able to apply
|
# Returns an array of status that user is able to apply
|
||||||
def new_statuses_allowed_to(user, include_default=false)
|
def new_statuses_allowed_to(user=User.current, include_default=false)
|
||||||
statuses = status.find_new_statuses_allowed_to(
|
statuses = status.find_new_statuses_allowed_to(
|
||||||
user.admin ? Role.all : user.roles_for_project(project),
|
user.admin ? Role.all : user.roles_for_project(project),
|
||||||
tracker,
|
tracker,
|
||||||
|
|
Loading…
Reference in New Issue