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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
4e88ca12
Commit
4e88ca12
authored
Oct 05, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide "New subgroup" links when subgroups are not supported
parent
17dccc35
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
10 deletions
+43
-10
app/views/groups/show.html.haml
app/views/groups/show.html.haml
+13
-10
spec/features/groups/show_spec.rb
spec/features/groups/show_spec.rb
+30
-0
No files found.
app/views/groups/show.html.haml
View file @
4e88ca12
-
@no_container
=
true
-
breadcrumb_title
"Details"
-
can_create_subgroups
=
can?
(
current_user
,
:create_subgroup
,
@group
)
=
content_for
:meta_tags
do
=
auto_discovery_link_tag
(
:atom
,
group_url
(
@group
,
rss_url_options
),
title:
"
#{
@group
.
name
}
activity"
)
...
...
@@ -16,6 +17,7 @@
-
new_subgroup_label
=
_
(
"New subgroup"
)
.btn-group.new-project-subgroup.droplab-dropdown.js-new-project-subgroup
{
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
{
type:
"button"
,
value:
new_project_label
,
data:
{
action:
"new-project"
}
}
-
if
can_create_subgroups
%button
.btn.btn-success.dropdown-toggle.js-dropdown-toggle
{
type:
"button"
,
data:
{
"dropdown-trigger"
=>
"#new-project-or-subgroup-dropdown"
}
}
=
icon
(
"caret-down"
,
class:
"dropdown-btn-icon"
)
%ul
#new-project-or-subgroup-dropdown
.dropdown-menu.dropdown-menu-align-right
{
data:
{
dropdown:
true
}
}
...
...
@@ -26,6 +28,7 @@
.description
%strong
=
new_project_label
%span
=
s_
(
"GroupsTree|Create project under this group."
)
-
if
can_create_subgroups
%li
.divider.droplap-item-ignore
%li
{
role:
"button"
,
data:
{
value:
"new-subgroup"
,
text:
new_subgroup_label
}
}
.menu-item
...
...
spec/features/groups/show_spec.rb
View file @
4e88ca12
...
...
@@ -24,4 +24,34 @@ feature 'Group show page' do
it_behaves_like
"an autodiscoverable RSS feed without an RSS token"
end
context
'subgroup support'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
group
.
add_owner
(
user
)
sign_in
(
user
)
end
context
'when subgroups are supported'
,
:js
do
before
do
allow
(
Group
).
to
receive
(
:supports_nested_groups?
)
{
true
}
visit
path
end
it
'allows creating subgroups'
do
expect
(
page
).
to
have_css
(
"li[data-text='New subgroup']"
,
visible:
false
)
end
end
context
'when subgroups are not supported'
do
before
do
allow
(
Group
).
to
receive
(
:supports_nested_groups?
)
{
false
}
visit
path
end
it
'allows creating subgroups'
do
expect
(
page
).
not_to
have_selector
(
"li[data-text='New subgroup']"
,
visible:
false
)
end
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