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
2bdb960f
Commit
2bdb960f
authored
Nov 19, 2021
by
Brandon Labuschagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate snippets tabs to rails helper
Changelog: changed
parent
e8c59dbe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
31 deletions
+18
-31
app/views/snippets/_snippets_scope_menu.html.haml
app/views/snippets/_snippets_scope_menu.html.haml
+14
-27
spec/features/snippets/user_snippets_spec.rb
spec/features/snippets/user_snippets_spec.rb
+3
-3
spec/support/shared_examples/features/snippets_shared_examples.rb
...port/shared_examples/features/snippets_shared_examples.rb
+1
-1
No files found.
app/views/snippets/_snippets_scope_menu.html.haml
View file @
2bdb960f
-
subject
=
local_assigns
.
fetch
(
:subject
,
current_user
)
-
include_private
=
local_assigns
.
fetch
(
:include_private
,
false
)
-
params
[
:scope
]
||=
[]
.nav-links.snippet-scope-menu.mobile-separator.nav.nav-tabs
%li
{
class:
active_when
(
params
[
:scope
].
nil?
)
}
=
link_to
subject_snippets_path
(
subject
)
do
=
_
(
"All"
)
%span
.badge.badge-muted.badge-pill.gl-badge.sm
=
gl_tabs_nav
({
class:
'js-snippets-nav-tabs gl-border-b-0 gl-overflow-x-auto gl-flex-grow-1 gl-flex-nowrap'
})
do
=
gl_tab_link_to
subject_snippets_path
(
subject
),
{
item_active:
params
[
:scope
].
empty?
}
do
=
_
(
'All'
)
=
gl_tab_counter_badge
(
include_private
?
counts
[
:total
]
:
counts
[
:are_public_or_internal
])
-
if
include_private
=
counts
[
:total
]
-
else
=
counts
[
:are_public_or_internal
]
-
if
include_private
%li
{
class:
active_when
(
params
[
:scope
]
==
"are_private"
)
}
=
link_to
subject_snippets_path
(
subject
,
scope:
'are_private'
)
do
=
_
(
"Private"
)
%span
.badge.badge-muted.badge-pill.gl-badge.sm
=
counts
[
:are_private
]
%li
{
class:
active_when
(
params
[
:scope
]
==
"are_internal"
)
}
=
link_to
subject_snippets_path
(
subject
,
scope:
'are_internal'
)
do
=
_
(
"Internal"
)
%span
.badge.badge-muted.badge-pill.gl-badge.sm
=
counts
[
:are_internal
]
%li
{
class:
active_when
(
params
[
:scope
]
==
"are_public"
)
}
=
link_to
subject_snippets_path
(
subject
,
scope:
'are_public'
)
do
=
_
(
"Public"
)
%span
.badge.badge-muted.badge-pill.gl-badge.sm
=
counts
[
:are_public
]
=
gl_tab_link_to
subject_snippets_path
(
subject
,
scope:
'are_private'
)
do
=
_
(
'Private'
)
=
gl_tab_counter_badge
(
counts
[
:are_private
])
=
gl_tab_link_to
subject_snippets_path
(
subject
,
scope:
'are_internal'
)
do
=
_
(
'Internal'
)
=
gl_tab_counter_badge
(
counts
[
:are_internal
])
=
gl_tab_link_to
subject_snippets_path
(
subject
,
scope:
'are_public'
)
do
=
_
(
'Public'
)
=
gl_tab_counter_badge
(
counts
[
:are_public
])
spec/features/snippets/user_snippets_spec.rb
View file @
2bdb960f
...
...
@@ -20,7 +20,7 @@ RSpec.describe 'User Snippets' do
end
it
'view my public snippets'
do
page
.
within
(
'.
snippet-scope-menu
'
)
do
page
.
within
(
'.
js-snippets-nav-tabs
'
)
do
click_link
"Public"
end
...
...
@@ -30,7 +30,7 @@ RSpec.describe 'User Snippets' do
end
it
'view my internal snippets'
do
page
.
within
(
'.
snippet-scope-menu
'
)
do
page
.
within
(
'.
js-snippets-nav-tabs
'
)
do
click_link
"Internal"
end
...
...
@@ -40,7 +40,7 @@ RSpec.describe 'User Snippets' do
end
it
'view my private snippets'
do
page
.
within
(
'.
snippet-scope-menu
'
)
do
page
.
within
(
'.
js-snippets-nav-tabs
'
)
do
click_link
"Private"
end
...
...
spec/support/shared_examples/features/snippets_shared_examples.rb
View file @
2bdb960f
...
...
@@ -20,7 +20,7 @@ RSpec.shared_examples 'paginated snippets' do |remote: false|
end
RSpec
.
shared_examples
'tabs with counts'
do
let
(
:tabs
)
{
page
.
all
(
'.
snippet-scope-menu
li'
)
}
let
(
:tabs
)
{
page
.
all
(
'.
js-snippets-nav-tabs
li'
)
}
it
'shows a tab for All snippets and count'
do
tab
=
tabs
[
0
]
...
...
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