Commit b63c08b2 authored by Rubén Dávila's avatar Rubén Dávila Committed by Mike Greiling

Build Project in context of Namespace if available

parent b7b49c4a
...@@ -3,6 +3,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -3,6 +3,7 @@ class ProjectsController < Projects::ApplicationController
include ExtractsPath include ExtractsPath
before_action :authenticate_user!, except: [:index, :show, :activity, :refs] before_action :authenticate_user!, except: [:index, :show, :activity, :refs]
before_action :namespace, only: [:new]
before_action :project, except: [:index, :new, :create] before_action :project, except: [:index, :new, :create]
before_action :repository, except: [:index, :new, :create] before_action :repository, except: [:index, :new, :create]
before_action :assign_ref_vars, only: [:show], if: :repo_exists? before_action :assign_ref_vars, only: [:show], if: :repo_exists?
...@@ -20,7 +21,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -20,7 +21,7 @@ class ProjectsController < Projects::ApplicationController
end end
def new def new
@project = Project.new build_project
end end
def edit def edit
...@@ -395,4 +396,12 @@ class ProjectsController < Projects::ApplicationController ...@@ -395,4 +396,12 @@ class ProjectsController < Projects::ApplicationController
def project_export_enabled def project_export_enabled
render_404 unless current_application_settings.project_export_enabled? render_404 unless current_application_settings.project_export_enabled?
end end
def namespace
@namespace ||= Namespace.find(params[:namespace_id]) if params[:namespace_id].present?
end
def build_project
@project ||= namespace ? namespace.projects.new : Project.new
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment