kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
2.2 KiB
57 lines
2.2 KiB
13 years ago
|
#-- encoding: UTF-8
|
||
14 years ago
|
#-- copyright
|
||
|
# ChiliProject is a project management system.
|
||
14 years ago
|
#
|
||
14 years ago
|
# Copyright (C) 2010-2011 the ChiliProject Team
|
||
14 years ago
|
#
|
||
14 years ago
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
14 years ago
|
#
|
||
14 years ago
|
# See doc/COPYRIGHT.rdoc for more details.
|
||
|
#++
|
||
|
|
||
12 years ago
|
class Issues::ContextMenusController < ApplicationController
|
||
14 years ago
|
|
||
14 years ago
|
def issues
|
||
14 years ago
|
@issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project)
|
||
14 years ago
|
|
||
14 years ago
|
if (@issues.size == 1)
|
||
|
@issue = @issues.first
|
||
|
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||
14 years ago
|
else
|
||
|
@allowed_statuses = @issues.map do |i|
|
||
|
i.new_statuses_allowed_to(User.current)
|
||
|
end.inject do |memo,s|
|
||
|
memo & s
|
||
|
end
|
||
14 years ago
|
end
|
||
14 years ago
|
@projects = @issues.collect(&:project).compact.uniq
|
||
|
@project = @projects.first if @projects.size == 1
|
||
14 years ago
|
|
||
14 years ago
|
@can = {:edit => User.current.allowed_to?(:edit_issues, @projects),
|
||
14 years ago
|
:log_time => (@project && User.current.allowed_to?(:log_time, @project)),
|
||
14 years ago
|
:update => (User.current.allowed_to?(:edit_issues, @projects) || (User.current.allowed_to?(:change_status, @projects) && !@allowed_statuses.blank?)),
|
||
14 years ago
|
:move => (@project && User.current.allowed_to?(:move_issues, @project)),
|
||
|
:copy => (@issue && @project.trackers.include?(@issue.tracker) && User.current.allowed_to?(:add_issues, @project)),
|
||
14 years ago
|
:delete => User.current.allowed_to?(:delete_issues, @projects)
|
||
14 years ago
|
}
|
||
|
if @project
|
||
|
@assignables = @project.assignable_users
|
||
|
@assignables << @issue.assigned_to if @issue && @issue.assigned_to && !@assignables.include?(@issue.assigned_to)
|
||
|
@trackers = @project.trackers
|
||
14 years ago
|
else
|
||
|
#when multiple projects, we only keep the intersection of each set
|
||
|
@assignables = @projects.map(&:assignable_users).inject{|memo,a| memo & a}
|
||
|
@trackers = @projects.map(&:trackers).inject{|memo,t| memo & t}
|
||
14 years ago
|
end
|
||
14 years ago
|
|
||
14 years ago
|
@priorities = IssuePriority.all.reverse
|
||
|
@statuses = IssueStatus.find(:all, :order => 'position')
|
||
|
@back = back_url
|
||
14 years ago
|
|
||
14 years ago
|
render :layout => false
|
||
|
end
|
||
|
end
|