BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
10 deletions
+43
-10
show.html.haml
app/views/groups/show.html.haml
+13
-10
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,8 +17,9 @@
-
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"
}
}
%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"
)
-
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
}
}
%li
.droplab-item-selected
{
role:
"button"
,
data:
{
value:
"new-project"
,
text:
new_project_label
}
}
.menu-item
...
...
@@ -26,14 +28,15 @@
.description
%strong
=
new_project_label
%span
=
s_
(
"GroupsTree|Create project under this group."
)
%li
.divider.droplap-item-ignore
%li
{
role:
"button"
,
data:
{
value:
"new-subgroup"
,
text:
new_subgroup_label
}
}
.menu-item
.icon-container
=
icon
(
"check"
,
class:
"list-item-checkmark"
)
.description
%strong
=
new_subgroup_label
%span
=
s_
(
"GroupsTree|Create a subgroup 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
.icon-container
=
icon
(
"check"
,
class:
"list-item-checkmark"
)
.description
%strong
=
new_subgroup_label
%span
=
s_
(
"GroupsTree|Create a subgroup under this group."
)
-
if
params
[
:filter
].
blank?
&&
@children
.
empty?
=
render
"shared/groups/empty_state"
...
...
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