summaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-08-12 13:57:51 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-08-12 13:57:51 +0000
commitf18b126fba301d32474357f05aeab6c39958153c (patch)
tree9bf68f13cda14d684c2c895c905d9757a2745a94 /app/controllers/application_controller.rb
parenta6112ef40d234ae51bf35cef0cc939794f38ede8 (diff)
downloadredmine-f18b126fba301d32474357f05aeab6c39958153c.tar.gz
redmine-f18b126fba301d32474357f05aeab6c39958153c.zip
Refactor: Pull up method to ApplicationController.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3938 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index c00b6ba42..3e482cf4b 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -201,7 +201,23 @@ class ApplicationController < ActionController::Base
def self.model_object(model)
write_inheritable_attribute('model_object', model)
end
-
+
+ # Filter for bulk issue operations
+ def find_issues
+ @issues = Issue.find_all_by_id(params[:id] || params[:ids])
+ raise ActiveRecord::RecordNotFound if @issues.empty?
+ projects = @issues.collect(&:project).compact.uniq
+ if projects.size == 1
+ @project = projects.first
+ else
+ # TODO: let users bulk edit/move/destroy issues from different projects
+ render_error 'Can not bulk edit/move/destroy issues from different projects'
+ return false
+ end
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
+
# make sure that the user is a member of the project (or admin) if project is private
# used as a before_filter for actions that do not require any particular permission on the project
def check_project_privacy