BigW Consortium Gitlab

After merge cleanup

parent aae947cb
......@@ -26,13 +26,9 @@ class ProjectsController < Projects::ApplicationController
render 'edit'
end
def create
@project =
if project_from_template?
::Projects::CreateFromTemplateService.new(current_user, project_params).execute
else
::Projects::CreateService.new(current_user, project_params).execute
end
@project = ::Projects::CreateService.new(current_user, project_params).execute
if @project.saved?
cookies[:issue_board_welcome_hidden] = { path: project_path(@project), value: nil, expires: Time.at(0) }
......@@ -351,10 +347,6 @@ class ProjectsController < Projects::ApplicationController
false
end
def project_from_template?
project_params[:template_name]&.present?
end
def project_view_files?
if current_user
current_user.project_view == 'files'
......
......@@ -5,6 +5,10 @@ module Projects
end
def execute
if @params[:template_name]&.present?
return ::Projects::CreateFromTemplateService.new(current_user, params).execute
end
forked_from_project_id = params.delete(:forked_from_project_id)
import_data = params.delete(:import_data)
@skip_wiki = params.delete(:skip_wiki)
......
......@@ -25,7 +25,7 @@
.form-group
= f.label :template_project, class: 'label-light' do
Create from template
= link_to icon('question-circle'), help_page_path("public_access/public_access"), aria: { label: "What's included in a template?" }, title: "What's included in a template?", class: 'has-tooltip', data: { placement: 'top'}
= link_to icon('question-circle'), help_page_path("public_access/public_access"), aria: { label: "What’s included in a template?" }, title: "What’s included in a template?", class: 'has-tooltip', data: { placement: 'top'}
%div
= render 'project_templates', f: f
.second-column
......
---
title: Projects can be created from templates
merge_request: 13108
author:
......@@ -146,3 +146,20 @@ If new emoji are added, the spritesheet may change size. To compensate for
such changes, first generate the `emoji.png` spritesheet with the above Rake
task, then check the dimensions of the new spritesheet and update the
`SPRITESHEET_WIDTH` and `SPRITESHEET_HEIGHT` constants accordingly.
## Updating project templates
Starting a project from a template needs this project to be exported. On a
up to date master branch with run:
```
gdk run db
# In a new terminal window
bundle exec rake gitlab:update_project_templates
git checkout -b update-project-templates
git add vendor/project_templates
git commit
git push -u origin update-project-templates
```
Now create a merge request and merge that to master.
......@@ -24,16 +24,17 @@ namespace :gitlab do
path: template.title,
skip_wiki: true
}
puts "Creating project for #{template.name}"
project = Projects::CreateService.new(admin, project).execute
project = Projects::CreateService.new(admin, params).execute
loop do
if project.import_status == "finished"
if project.finished?
puts "Import finished for #{template.name}"
break
end
if project.import_status == "failed"
if project.failed?
puts "Failed to import from #{project_params[:import_url]}".red
exit(1)
end
......
require 'spec_helper'
<<<<<<< HEAD
feature 'Project', feature: true do
feature 'Project' do
describe 'creating from template' do
let(:user) { create(:user) }
let(:template) { Gitlab::ProjectTemplate.find(:rails) }
......@@ -23,9 +22,6 @@ feature 'Project', feature: true do
end
end
=======
feature 'Project' do
>>>>>>> master
describe 'description' do
let(:project) { create(:project, :repository) }
let(:path) { project_path(project) }
......
......@@ -31,7 +31,7 @@ describe Gitlab::ProjectTemplate do
describe 'instance methods' do
subject { described_class.new('phoenix', 'Phoenix Framework') }
it { is_expected.to respond_to(:logo_path, :file, :archive_path) }
it { is_expected.to respond_to(:logo, :file, :archive_path) }
end
describe 'validate all templates' do
......
......@@ -5,7 +5,7 @@ describe Projects::CreateFromTemplateService do
let(:project_params) do
{
path: user.to_param,
template_title: 'rails'
template_name: 'rails'
}
end
......@@ -21,6 +21,6 @@ describe Projects::CreateFromTemplateService do
project = subject.execute
expect(project).to be_saved
expect(project.import_status).to eq('scheduled')
expect(project.scheduled?).to be(true)
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