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 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
@ -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