Commit 030de344 authored by Rubén Dávila's avatar Rubén Dávila
Browse files

Backport from gitlab-org/gitlab-ee!6878

parent 4c5e579cd482
...@@ -5,6 +5,7 @@ import axios from './lib/utils/axios_utils'; ...@@ -5,6 +5,7 @@ import axios from './lib/utils/axios_utils';
const Api = { const Api = {
groupsPath: '/api/:version/groups.json', groupsPath: '/api/:version/groups.json',
groupPath: '/api/:version/groups/:id', groupPath: '/api/:version/groups/:id',
subgroupsPath: '/api/:version/groups/:id/subgroups',
namespacesPath: '/api/:version/namespaces.json', namespacesPath: '/api/:version/namespaces.json',
groupProjectsPath: '/api/:version/groups/:id/projects.json', groupProjectsPath: '/api/:version/groups/:id/projects.json',
projectsPath: '/api/:version/projects.json', projectsPath: '/api/:version/projects.json',
......
...@@ -9,7 +9,7 @@ def initialize(user, params) ...@@ -9,7 +9,7 @@ def initialize(user, params)
end end
def execute def execute
if @params[:template_name]&.present? if @params[:template_name].present?
return ::Projects::CreateFromTemplateService.new(current_user, params).execute return ::Projects::CreateFromTemplateService.new(current_user, params).execute
end end
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
.settings-content .settings-content
= render 'shared/badges/badge_settings' = render 'shared/badges/badge_settings'
= render_if_exists 'groups/custom_project_templates_setting'
= render_if_exists 'groups/templates_setting', expanded: expanded = render_if_exists 'groups/templates_setting', expanded: expanded
%section.settings.gs-advanced.no-animate#js-advanced-settings{ class: ('expanded' if expanded) } %section.settings.gs-advanced.no-animate#js-advanced-settings{ class: ('expanded' if expanded) }
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
.project-template .project-template
.form-group .form-group
%div %div
= render 'project_templates', f: f = render 'project_templates', f: f, project: @project
.tab-pane.import-project-pane.js-toggle-container{ id: 'import-project-pane', class: active_when(active_tab == 'import'), role: 'tabpanel' } .tab-pane.import-project-pane.js-toggle-container{ id: 'import-project-pane', class: active_when(active_tab == 'import'), role: 'tabpanel' }
- if import_sources_enabled? - if import_sources_enabled?
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
.text-muted .text-muted
= template.description = template.description
.controls.d-flex.align-items-center .controls.d-flex.align-items-center
%label.btn.btn-success.template-button.choose-template.append-right-10.append-bottom-0{ for: template.name } %a.btn.btn-default.append-right-10{ href: template.preview, rel: 'noopener noreferrer', target: '_blank', data: { track_label: "create_from_template", track_property: "template_preview", track_event: "click_button", track_value: template.name } }
= _("Preview")
%label.btn.btn-success.template-button.choose-template.append-bottom-0{ for: template.name }
%input{ type: "radio", autocomplete: "off", name: "project[template_name]", id: template.name, value: template.name, data: { track_label: "create_from_template", track_property: "template_use", track_event: "click_button" } } %input{ type: "radio", autocomplete: "off", name: "project[template_name]", id: template.name, value: template.name, data: { track_label: "create_from_template", track_property: "template_use", track_event: "click_button" } }
%span %span
= _("Use template") = _("Use template")
%a.btn.btn-default{ href: template.preview, rel: 'noopener noreferrer', target: '_blank', data: { track_label: "create_from_template", track_property: "template_preview", track_event: "click_button", track_value: template.name } }
= _("Preview")
...@@ -94,17 +94,18 @@ ...@@ -94,17 +94,18 @@
end end
context 'for milestones (by group)' do context 'for milestones (by group)' do
# milestones (by group) is a little different than all of the other models # milestones (by group) is a little different than most of the other models
let!(:group1) { create(:group) } let(:groups) { table(:namespaces) }
let!(:group2) { create(:group) } let(:group1) { groups.create(name: 'Group 1', type: 'Group', path: 'group_1') }
let!(:group3) { create(:group) } let(:group2) { groups.create(name: 'Group 2', type: 'Group', path: 'group_2') }
let(:group3) { groups.create(name: 'Group 2', type: 'Group', path: 'group_3') }
let(:internal_id_query) { ->(group) { InternalId.where(usage: InternalId.usages['milestones'], namespace: group) } } let(:internal_id_query) { ->(group) { InternalId.where(usage: InternalId.usages['milestones'], namespace: group) } }
before do before do
3.times { create(:milestone, group: group1) } 3.times { create(:milestone, group_id: group1.id) }
3.times { create(:milestone, group: group2) } 3.times { create(:milestone, group_id: group2.id) }
3.times { create(:milestone, group: group3) } 3.times { create(:milestone, group_id: group3.id) }
internal_id_query.call(group1).first.tap do |iid| internal_id_query.call(group1).first.tap do |iid|
iid.last_value = iid.last_value - 2 iid.last_value = iid.last_value - 2
......
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