fixes creating new stories in subprojects

pull/6827/head
jwollert 12 years ago
parent 9539ac7ca8
commit 56e156c8d3
  1. 14
      app/controllers/rb_application_controller.rb

@ -4,19 +4,17 @@ class RbApplicationController < ApplicationController
helper :rb_common helper :rb_common
before_filter :load_project, :authorize, :check_if_plugin_is_configured before_filter :load_sprint_and_project, :authorize, :check_if_plugin_is_configured
private private
# Loads the project to be used by the authorize filter to # Loads the project to be used by the authorize filter to
# determine if User.current has permission to invoke the method in question. # determine if User.current has permission to invoke the method in question.
def load_project def load_sprint_and_project
if params[:sprint_id] load_sprint_and_parent_project if params[:sprint_id]
load_sprint_and_project # This overrides sprint's project if we set another project, say a subproject
else
@project = Project.find(params[:project_id]) if params[:project_id] @project = Project.find(params[:project_id]) if params[:project_id]
end end
end
def check_if_plugin_is_configured def check_if_plugin_is_configured
settings = Setting.plugin_openproject_backlogs settings = Setting.plugin_openproject_backlogs
@ -27,8 +25,8 @@ class RbApplicationController < ApplicationController
end end
end end
def load_sprint_and_project(id = params[:sprint_id].to_i) def load_sprint_and_parent_project
@sprint = Sprint.find(id) @sprint = Sprint.find(params[:sprint_id])
@project = @sprint.project @project = @sprint.project
end end
end end

Loading…
Cancel
Save