From 26d142e3a833c2ed75c9c5767c5fd3482a9d0744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Javier=20L=C3=B3pez?= Date: Wed, 25 Jul 2018 09:07:47 -0400 Subject: [PATCH] Code review comments applied --- app/services/projects/create_from_template_service.rb | 2 +- doc/gitlab-basics/create-project.md | 9 ++++++++- lib/gitlab/template_helper.rb | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/services/projects/create_from_template_service.rb b/app/services/projects/create_from_template_service.rb index 79b28ff6688..8306d43ca7c 100644 --- a/app/services/projects/create_from_template_service.rb +++ b/app/services/projects/create_from_template_service.rb @@ -21,7 +21,7 @@ module Projects def template_name strong_memoize(:template_name) do - params.delete(:template_name) + params.delete(:template_name).presence end end end diff --git a/doc/gitlab-basics/create-project.md b/doc/gitlab-basics/create-project.md index dd8d95a3bca..3a3303d3a4e 100644 --- a/doc/gitlab-basics/create-project.md +++ b/doc/gitlab-basics/create-project.md @@ -36,6 +36,13 @@ 1. Click **Create project**. +## Custom project templates +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/6860) in [GitLab Edition Premium][ee] 11.2 + +When you create a new project, creating it based on custom project templates is a convenient option to bootstrap from an existing project boilerplate. The administration setting to configure a GitLab group that serves as template source can be found under **Admin > Settings > Custom project templates**. + +Within this section, you can configure the group where all the custom project templates are sourced. Every project under the group namespace will be available to the user if they have access to them. For example: Every public project in the group will be available to the user. However, private projects will be available only if the user is authorized. + ## Push to create a new project > [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/26388) in GitLab 10.5. @@ -43,7 +50,7 @@ When you create a new repo locally, instead of going to GitLab to manually create a new project and then push the repo, you can directly push it to GitLab to create the new project, all without leaving your terminal. If you have access to that -namespace, we will automatically create a new project under that GitLab namespace with its +namespace, we will automatically create a new project under that GitLab namespace with its visibility set to Private by default (you can later change it in the [project's settings](../public_access/public_access.md#how-to-change-project-visibility)). This can be done by using either SSH or HTTP: diff --git a/lib/gitlab/template_helper.rb b/lib/gitlab/template_helper.rb index 6b4972d5f13..3b8e45e0688 100644 --- a/lib/gitlab/template_helper.rb +++ b/lib/gitlab/template_helper.rb @@ -1,5 +1,7 @@ module Gitlab module TemplateHelper + include Gitlab::Utils::StrongMemoize + def prepare_template_environment(file_path) return unless file_path.present?