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
ef09a654
Commit
ef09a654
authored
3 years ago
by
Nourdin el Bacha
Committed by
Paul Slaughter
3 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conditionally render create group buttons
- This is added to the old and new top nav Changelog: fixed
parent
91604ec8
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
7 deletions
+21
-7
app/helpers/nav/top_nav_helper.rb
app/helpers/nav/top_nav_helper.rb
+5
-1
app/views/layouts/nav/groups_dropdown/_show.html.haml
app/views/layouts/nav/groups_dropdown/_show.html.haml
+7
-6
spec/helpers/nav/top_nav_helper_spec.rb
spec/helpers/nav/top_nav_helper_spec.rb
+9
-0
No files found.
app/helpers/nav/top_nav_helper.rb
View file @
ef09a654
...
@@ -276,7 +276,11 @@ module Nav
...
@@ -276,7 +276,11 @@ module Nav
builder
=
::
Gitlab
::
Nav
::
TopNavMenuBuilder
.
new
builder
=
::
Gitlab
::
Nav
::
TopNavMenuBuilder
.
new
builder
.
add_primary_menu_item
(
id:
'your'
,
title:
_
(
'Your groups'
),
href:
dashboard_groups_path
)
builder
.
add_primary_menu_item
(
id:
'your'
,
title:
_
(
'Your groups'
),
href:
dashboard_groups_path
)
builder
.
add_primary_menu_item
(
id:
'explore'
,
title:
_
(
'Explore groups'
),
href:
explore_groups_path
)
builder
.
add_primary_menu_item
(
id:
'explore'
,
title:
_
(
'Explore groups'
),
href:
explore_groups_path
)
if
current_user
.
can_create_group?
builder
.
add_secondary_menu_item
(
id:
'create'
,
title:
_
(
'Create group'
),
href:
new_group_path
)
builder
.
add_secondary_menu_item
(
id:
'create'
,
title:
_
(
'Create group'
),
href:
new_group_path
)
end
builder
.
build
builder
.
build
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
app/views/layouts/nav/groups_dropdown/_show.html.haml
View file @
ef09a654
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
=
nav_link
(
path:
'groups#explore'
)
do
=
nav_link
(
path:
'groups#explore'
)
do
=
link_to
explore_groups_path
,
data:
{
track_label:
"groups_dropdown_explore_groups"
,
track_event:
"click_link"
}
do
=
link_to
explore_groups_path
,
data:
{
track_label:
"groups_dropdown_explore_groups"
,
track_event:
"click_link"
}
do
=
_
(
'Explore groups'
)
=
_
(
'Explore groups'
)
-
if
current_user
.
can_create_group?
=
nav_link
(
path:
'groups/new#create-group-pane'
,
html_options:
{
class:
'gl-border-0 gl-border-t-1 gl-border-solid gl-border-gray-100'
})
do
=
nav_link
(
path:
'groups/new#create-group-pane'
,
html_options:
{
class:
'gl-border-0 gl-border-t-1 gl-border-solid gl-border-gray-100'
})
do
=
link_to
new_group_path
(
anchor:
'create-group-pane'
),
data:
{
track_label:
"groups_dropdown_create_group"
,
track_event:
"click_link"
}
do
=
link_to
new_group_path
(
anchor:
'create-group-pane'
),
data:
{
track_label:
"groups_dropdown_create_group"
,
track_event:
"click_link"
}
do
=
_
(
'Create group'
)
=
_
(
'Create group'
)
...
...
This diff is collapsed.
Click to expand it.
spec/helpers/nav/top_nav_helper_spec.rb
View file @
ef09a654
...
@@ -7,6 +7,7 @@ RSpec.describe Nav::TopNavHelper do
...
@@ -7,6 +7,7 @@ RSpec.describe Nav::TopNavHelper do
let_it_be
(
:user
)
{
build_stubbed
(
:user
)
}
let_it_be
(
:user
)
{
build_stubbed
(
:user
)
}
let_it_be
(
:admin
)
{
build_stubbed
(
:user
,
:admin
)
}
let_it_be
(
:admin
)
{
build_stubbed
(
:user
,
:admin
)
}
let_it_be
(
:external_user
)
{
build_stubbed
(
:user
,
:external
,
can_create_group:
false
)
}
let
(
:current_user
)
{
nil
}
let
(
:current_user
)
{
nil
}
...
@@ -305,6 +306,14 @@ RSpec.describe Nav::TopNavHelper do
...
@@ -305,6 +306,14 @@ RSpec.describe Nav::TopNavHelper do
expect
(
groups_view
[
:linksSecondary
]).
to
eq
(
expected_links_secondary
)
expect
(
groups_view
[
:linksSecondary
]).
to
eq
(
expected_links_secondary
)
end
end
context
'with external user'
do
let
(
:current_user
)
{
external_user
}
it
'does not have create group link'
do
expect
(
groups_view
[
:linksSecondary
]).
to
eq
([])
end
end
context
'with current nav as group'
do
context
'with current nav as group'
do
before
do
before
do
helper
.
nav
(
'group'
)
helper
.
nav
(
'group'
)
...
...
This diff is collapsed.
Click to expand it.
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