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
Léo-Paul Géneau
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
Hide 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
-
@no_container
=
true
-
breadcrumb_title
"Details"
-
breadcrumb_title
"Details"
-
can_create_subgroups
=
can?
(
current_user
,
:create_subgroup
,
@group
)
=
content_for
:meta_tags
do
=
content_for
:meta_tags
do
=
auto_discovery_link_tag
(
:atom
,
group_url
(
@group
,
rss_url_options
),
title:
"
#{
@group
.
name
}
activity"
)
=
auto_discovery_link_tag
(
:atom
,
group_url
(
@group
,
rss_url_options
),
title:
"
#{
@group
.
name
}
activity"
)
...
@@ -16,8 +17,9 @@
...
@@ -16,8 +17,9 @@
-
new_subgroup_label
=
_
(
"New subgroup"
)
-
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
)
}
}
.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"
}
}
%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"
}
}
-
if
can_create_subgroups
=
icon
(
"caret-down"
,
class:
"dropdown-btn-icon"
)
%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
}
}
%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
}
}
%li
.droplab-item-selected
{
role:
"button"
,
data:
{
value:
"new-project"
,
text:
new_project_label
}
}
.menu-item
.menu-item
...
@@ -26,14 +28,15 @@
...
@@ -26,14 +28,15 @@
.description
.description
%strong
=
new_project_label
%strong
=
new_project_label
%span
=
s_
(
"GroupsTree|Create project under this group."
)
%span
=
s_
(
"GroupsTree|Create project under this group."
)
%li
.divider.droplap-item-ignore
-
if
can_create_subgroups
%li
{
role:
"button"
,
data:
{
value:
"new-subgroup"
,
text:
new_subgroup_label
}
}
%li
.divider.droplap-item-ignore
.menu-item
%li
{
role:
"button"
,
data:
{
value:
"new-subgroup"
,
text:
new_subgroup_label
}
}
.icon-container
.menu-item
=
icon
(
"check"
,
class:
"list-item-checkmark"
)
.icon-container
.description
=
icon
(
"check"
,
class:
"list-item-checkmark"
)
%strong
=
new_subgroup_label
.description
%span
=
s_
(
"GroupsTree|Create a subgroup under this group."
)
%strong
=
new_subgroup_label
%span
=
s_
(
"GroupsTree|Create a subgroup under this group."
)
-
if
params
[
:filter
].
blank?
&&
@children
.
empty?
-
if
params
[
:filter
].
blank?
&&
@children
.
empty?
=
render
"shared/groups/empty_state"
=
render
"shared/groups/empty_state"
...
...
spec/features/groups/show_spec.rb
View file @
4e88ca12
...
@@ -24,4 +24,34 @@ feature 'Group show page' do
...
@@ -24,4 +24,34 @@ feature 'Group show page' do
it_behaves_like
"an autodiscoverable RSS feed without an RSS token"
it_behaves_like
"an autodiscoverable RSS feed without an RSS token"
end
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
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