Merge pull request #15 from finnlabs/fix/create_story_in_subproject

fixes creating new stories in subprojects
pull/6827/head
sschu 12 years ago
commit 87d51f34b0
  1. 16
      app/controllers/rb_application_controller.rb

@ -4,18 +4,16 @@ class RbApplicationController < ApplicationController
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
# Loads the project to be used by the authorize filter to
# determine if User.current has permission to invoke the method in question.
def load_project
if params[:sprint_id]
load_sprint_and_project
else
@project = Project.find(params[:project_id]) if params[:project_id]
end
def load_sprint_and_project
load_sprint_and_parent_project if params[:sprint_id]
# This overrides sprint's project if we set another project, say a subproject
@project = Project.find(params[:project_id]) if params[:project_id]
end
def check_if_plugin_is_configured
@ -27,8 +25,8 @@ class RbApplicationController < ApplicationController
end
end
def load_sprint_and_project(id = params[:sprint_id].to_i)
@sprint = Sprint.find(id)
def load_sprint_and_parent_project
@sprint = Sprint.find(params[:sprint_id])
@project = @sprint.project
end
end

Loading…
Cancel
Save