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
53121710
Commit
53121710
authored
Apr 28, 2020
by
Mattias Michaux
Committed by
Natalia Tepluhina
Apr 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create subgroup without create project permission
parent
796bd5f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
22 deletions
+65
-22
app/views/groups/_home_panel.html.haml
app/views/groups/_home_panel.html.haml
+24
-22
changelogs/unreleased/205513-create-subgroup-without-project-permission.yml
...sed/205513-create-subgroup-without-project-permission.yml
+5
-0
spec/features/groups_spec.rb
spec/features/groups_spec.rb
+36
-0
No files found.
app/views/groups/_home_panel.html.haml
View file @
53121710
-
can_create_subgroups
=
can?
(
current_user
,
:create_subgroup
,
@group
)
-
can_create_subgroups
=
can?
(
current_user
,
:create_subgroup
,
@group
)
-
can_create_projects
=
can?
(
current_user
,
:create_projects
,
@group
)
-
emails_disabled
=
@group
.
emails_disabled?
-
emails_disabled
=
@group
.
emails_disabled?
.group-home-panel
.group-home-panel
...
@@ -23,32 +24,33 @@
...
@@ -23,32 +24,33 @@
-
if
current_user
-
if
current_user
.group-buttons
.group-buttons
=
render
'shared/notifications/new_button'
,
notification_setting:
@notification_setting
,
btn_class:
'btn'
,
emails_disabled:
emails_disabled
=
render
'shared/notifications/new_button'
,
notification_setting:
@notification_setting
,
btn_class:
'btn'
,
emails_disabled:
emails_disabled
-
if
can?
current_user
,
:create_projects
,
@group
-
new_project_label
=
_
(
"New project"
)
-
new_project_label
=
_
(
"New project"
)
-
new_subgroup_label
=
_
(
"New subgroup"
)
-
new_subgroup_label
=
_
(
"New subgroup"
)
-
if
can_create_projects
and
can_create_subgroups
-
if
can_create_subgroups
.btn-group.new-project-subgroup.droplab-dropdown.home-panel-action-button.prepend-top-default.js-new-project-subgroup.qa-new-project-or-subgroup-dropdown
{
data:
{
project_path:
new_project_path
(
namespace_id:
@group
.
id
),
subgroup_path:
new_group_path
(
parent_id:
@group
.
id
)
}
}
.btn-group.new-project-subgroup.droplab-dropdown.home-panel-action-button.prepend-top-default.js-new-project-subgroup.qa-new-project-or-subgroup-dropdown
{
data:
{
project_path:
new_project_path
(
namespace_id:
@group
.
id
),
subgroup_path:
new_group_path
(
parent_id:
@group
.
id
)
}
}
%input
.btn.btn-success.dropdown-primary.js-new-group-child.qa-new-in-group-button
{
type:
"button"
,
value:
new_project_label
,
data:
{
action:
"new-project"
}
}
%input
.btn.btn-success.dropdown-primary.js-new-group-child.qa-new-in-group-button
{
type:
"button"
,
value:
new_project_label
,
data:
{
action:
"new-project"
}
}
%button
.btn.btn-success.dropdown-toggle.js-dropdown-toggle.qa-new-project-or-subgroup-dropdown-toggle
{
type:
"button"
,
data:
{
"dropdown-trigger"
=>
"#new-project-or-subgroup-dropdown"
,
'display'
=>
'static'
}
}
%button
.btn.btn-success.dropdown-toggle.js-dropdown-toggle.qa-new-project-or-subgroup-dropdown-toggle
{
type:
"button"
,
data:
{
"dropdown-trigger"
=>
"#new-project-or-subgroup-dropdown"
,
'display'
=>
'static'
}
}
=
sprite_icon
(
"chevron-down"
,
css_class:
"icon dropdown-btn-icon"
)
=
sprite_icon
(
"chevron-down"
,
css_class:
"icon dropdown-btn-icon"
)
%ul
#new-project-or-subgroup-dropdown
.dropdown-menu.dropdown-menu-right
{
data:
{
dropdown:
true
}
}
%ul
#new-project-or-subgroup-dropdown
.dropdown-menu.dropdown-menu-right
{
data:
{
dropdown:
true
}
}
%li
.droplab-item-selected.qa-new-project-option
{
role:
"button"
,
data:
{
value:
"new-project"
,
text:
new_project_label
}
}
%li
.droplab-item-selected.qa-new-project-option
{
role:
"button"
,
data:
{
value:
"new-project"
,
text:
new_project_label
}
}
.menu-item
.icon-container
=
icon
(
"check"
,
class:
"list-item-checkmark"
)
.description
%strong
=
new_project_label
%span
=
s_
(
"GroupsTree|Create a project in this group."
)
%li
.divider.droplap-item-ignore
%li
.qa-new-subgroup-option
{
role:
"button"
,
data:
{
value:
"new-subgroup"
,
text:
new_subgroup_label
}
}
.menu-item
.menu-item
.icon-container
.icon-container
=
icon
(
"check"
,
class:
"list-item-checkmark"
)
=
icon
(
"check"
,
class:
"list-item-checkmark"
)
.description
.description
%strong
=
new_project_label
%strong
=
new_subgroup_label
%span
=
s_
(
"GroupsTree|Create a project in this group."
)
%span
=
s_
(
"GroupsTree|Create a subgroup in this group."
)
%li
.divider.droplap-item-ignore
-
elsif
can_create_projects
%li
.qa-new-subgroup-option
{
role:
"button"
,
data:
{
value:
"new-subgroup"
,
text:
new_subgroup_label
}
}
=
link_to
new_project_label
,
new_project_path
(
namespace_id:
@group
.
id
),
class:
"btn btn-success prepend-top-default"
.menu-item
-
elsif
can_create_subgroups
.icon-container
=
link_to
new_subgroup_label
,
new_group_path
(
parent_id:
@group
.
id
),
class:
"btn btn-success prepend-top-default"
=
icon
(
"check"
,
class:
"list-item-checkmark"
)
.description
%strong
=
new_subgroup_label
%span
=
s_
(
"GroupsTree|Create a subgroup in this group."
)
-
else
=
link_to
new_project_label
,
new_project_path
(
namespace_id:
@group
.
id
),
class:
"btn btn-success prepend-top-default"
-
if
@group
.
description
.
present?
-
if
@group
.
description
.
present?
.group-home-desc.mt-1
.group-home-desc.mt-1
...
...
changelogs/unreleased/205513-create-subgroup-without-project-permission.yml
0 → 100644
View file @
53121710
---
title
:
Always display new subgroup button when permission is granted
merge_request
:
28309
author
:
Mattias Michaux
type
:
fixed
spec/features/groups_spec.rb
View file @
53121710
...
@@ -262,6 +262,42 @@ describe 'Group' do
...
@@ -262,6 +262,42 @@ describe 'Group' do
end
end
end
end
describe
'new subgroup / project button'
do
let
(
:group
)
{
create
(
:group
,
project_creation_level:
Gitlab
::
Access
::
NO_ONE_PROJECT_ACCESS
,
subgroup_creation_level:
Gitlab
::
Access
::
OWNER_SUBGROUP_ACCESS
)
}
it
'new subgroup button is displayed without project creation permission'
do
visit
group_path
(
group
)
page
.
within
'.group-buttons'
do
expect
(
page
).
to
have_link
(
'New subgroup'
)
end
end
it
'new subgroup button is displayed together with new project button when having project creation permission'
do
group
.
update!
(
project_creation_level:
Gitlab
::
Access
::
MAINTAINER_PROJECT_ACCESS
)
visit
group_path
(
group
)
page
.
within
'.group-buttons'
do
expect
(
page
).
to
have_css
(
"li[data-text='New subgroup']"
,
visible:
false
)
expect
(
page
).
to
have_css
(
"li[data-text='New project']"
,
visible:
false
)
end
end
it
'new project button is displayed without subgroup creation permission'
do
group
.
update!
(
project_creation_level:
Gitlab
::
Access
::
MAINTAINER_PROJECT_ACCESS
)
user
=
create
(
:user
)
group
.
add_maintainer
(
user
)
sign_out
(
:user
)
sign_in
(
user
)
visit
group_path
(
group
)
page
.
within
'.group-buttons'
do
expect
(
page
).
to
have_link
(
'New project'
)
end
end
end
def
remove_with_confirm
(
button_text
,
confirm_with
)
def
remove_with_confirm
(
button_text
,
confirm_with
)
click_button
button_text
click_button
button_text
fill_in
'confirm_name_input'
,
with:
confirm_with
fill_in
'confirm_name_input'
,
with:
confirm_with
...
...
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