Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
87ff15e7
Commit
87ff15e7
authored
Jun 10, 2020
by
Lee Tickett
Committed by
Illya Klymov
Jun 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix default path when creating project from group template
parent
0806f699
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
4 deletions
+48
-4
changelogs/unreleased/fix_default_path_when_creating_project_from_group_template.yml
...efault_path_when_creating_project_from_group_template.yml
+5
-0
ee/app/assets/javascripts/projects/custom_project_templates.js
...p/assets/javascripts/projects/custom_project_templates.js
+3
-2
ee/app/views/users/_custom_project_templates_from_groups.html.haml
...ews/users/_custom_project_templates_from_groups.html.haml
+1
-1
ee/app/views/users/available_group_templates.js.haml
ee/app/views/users/available_group_templates.js.haml
+1
-1
ee/spec/features/projects_spec.rb
ee/spec/features/projects_spec.rb
+38
-0
No files found.
changelogs/unreleased/fix_default_path_when_creating_project_from_group_template.yml
0 → 100644
View file @
87ff15e7
---
title
:
Fix default path when creating project from group template
merge_request
:
30597
author
:
Lee Tickett
type
:
fixed
ee/app/assets/javascripts/projects/custom_project_templates.js
View file @
87ff15e7
...
@@ -56,11 +56,12 @@ const bindEvents = () => {
...
@@ -56,11 +56,12 @@ const bindEvents = () => {
function
chooseTemplate
()
{
function
chooseTemplate
()
{
const
subgroupId
=
$
(
this
).
data
(
'
subgroup-id
'
);
const
subgroupId
=
$
(
this
).
data
(
'
subgroup-id
'
);
const
groupId
=
$
(
this
).
data
(
'
parent-group-id
'
);
const
templateName
=
$
(
this
).
data
(
'
template-name
'
);
const
templateName
=
$
(
this
).
data
(
'
template-name
'
);
if
(
subgroupId
)
{
if
(
subgroupId
)
{
$subgroupWithTemplatesIdInput
.
val
(
subgroupId
);
$subgroupWithTemplatesIdInput
.
val
(
subgroupId
);
$namespaceSelect
.
val
(
sub
groupId
).
trigger
(
'
change
'
);
$namespaceSelect
.
val
(
groupId
).
trigger
(
'
change
'
);
hideNonRootParentPathOptions
();
hideNonRootParentPathOptions
();
...
@@ -102,7 +103,7 @@ const bindEvents = () => {
...
@@ -102,7 +103,7 @@ const bindEvents = () => {
$projectFieldsForm
$projectFieldsForm
.
find
(
'
.js-select-namespace
'
)
.
find
(
'
.js-select-namespace
'
)
.
first
()
.
first
()
.
val
(
sub
groupId
);
.
val
(
groupId
);
}
}
$useCustomTemplateBtn
.
on
(
'
change
'
,
chooseTemplate
);
$useCustomTemplateBtn
.
on
(
'
change
'
,
chooseTemplate
);
...
...
ee/app/views/users/_custom_project_templates_from_groups.html.haml
View file @
87ff15e7
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
%a
.btn.btn-default.append-right-10
{
href:
project_path
(
project
),
rel:
'noopener noreferrer'
,
target:
'_blank'
}
%a
.btn.btn-default.append-right-10
{
href:
project_path
(
project
),
rel:
'noopener noreferrer'
,
target:
'_blank'
}
=
_
(
'Preview'
)
=
_
(
'Preview'
)
%label
.btn.btn-success.custom-template-button.choose-template.gl-mb-0
{
for:
project
.
name
}
%label
.btn.btn-success.custom-template-button.choose-template.gl-mb-0
{
for:
project
.
name
}
%input
{
type:
"radio"
,
autocomplete:
"off"
,
name:
"project[template_project_id]"
,
id:
project
.
name
,
value:
project
.
id
,
data:
{
subgroup_id:
project
.
namespace_id
,
template_name:
project
.
name
}
}
%input
{
type:
"radio"
,
autocomplete:
"off"
,
name:
"project[template_project_id]"
,
id:
project
.
name
,
value:
project
.
id
,
data:
{
subgroup_id:
project
.
namespace_id
,
template_name:
project
.
name
,
parent_group_id:
namespace_id
||
group
.
parent_id
}
}
%span
.qa-use-template-button
%span
.qa-use-template-button
=
_
(
'Use template'
)
=
_
(
'Use template'
)
...
...
ee/app/views/users/available_group_templates.js.haml
View file @
87ff15e7
:plain
:plain
var target = $(".project-templates-buttons#custom-group-project-templates");
var target = $(".project-templates-buttons#custom-group-project-templates");
target.empty();
target.empty();
target.html("
#{
escape_javascript
(
render
(
'custom_project_templates_from_groups'
,
groups_with_project_templates:
@groups_with_project_templates
))
}
");
target.html("
#{
escape_javascript
(
render
(
'custom_project_templates_from_groups'
,
groups_with_project_templates:
@groups_with_project_templates
,
namespace_id:
params
[
:group_id
]
))
}
");
target.trigger("ajax:success");
target.trigger("ajax:success");
ee/spec/features/projects_spec.rb
0 → 100644
View file @
87ff15e7
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'Project'
do
describe
'when creating from group template'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
name:
'parent-group'
)
}
let
(
:template_subgroup
)
{
create
(
:group
,
parent:
group
,
name:
'template-subgroup'
)
}
let
(
:other_subgroup
)
{
create
(
:group
,
parent:
group
,
name:
'other-subgroup'
)
}
let
(
:template
)
{
create
(
:project
,
namespace:
template_subgroup
)
}
before
do
stub_licensed_features
(
custom_project_templates:
true
)
group
.
add_owner
(
user
)
group
.
update!
(
custom_project_templates_group_id:
template_subgroup
.
id
)
sign_in
user
end
it
"defaults to correct namespace"
,
:js
do
visit
new_project_path
find
(
'#create-from-template-tab'
).
click
find
(
'.custom-group-project-templates-tab'
).
click
find
(
"label[for=
#{
template
.
name
}
]"
).
click
expect
(
find
(
'.js-select-namespace'
)).
to
have_content
group
.
name
end
it
"uses supplied namespace"
,
:js
do
visit
new_project_path
(
namespace_id:
other_subgroup
.
id
)
find
(
'#create-from-template-tab'
).
click
find
(
'.custom-group-project-templates-tab'
).
click
find
(
"label[for=
#{
template
.
name
}
]"
).
click
expect
(
find
(
'.js-select-namespace'
)).
to
have_content
other_subgroup
.
name
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment