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
0266e1b3
Commit
0266e1b3
authored
Mar 30, 2022
by
Alper Akgun
Committed by
Alex Pooley
Mar 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make group runners sorting Pajamas compliant
parent
0bd90233
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
22 deletions
+24
-22
app/helpers/sorting_helper.rb
app/helpers/sorting_helper.rb
+7
-0
app/views/groups/runners/_sort_dropdown.html.haml
app/views/groups/runners/_sort_dropdown.html.haml
+2
-9
ee/spec/helpers/ee/sorting_helper_spec.rb
ee/spec/helpers/ee/sorting_helper_spec.rb
+7
-0
spec/views/groups/runners/_sort_dropdown.html.haml_spec.rb
spec/views/groups/runners/_sort_dropdown.html.haml_spec.rb
+8
-13
No files found.
app/helpers/sorting_helper.rb
View file @
0266e1b3
...
...
@@ -186,6 +186,13 @@ module SortingHelper
}
end
def
runners_sort_options_hash
{
sort_value_created_date
=>
sort_title_created_date
,
sort_value_contacted_date
=>
sort_title_contacted_date
}
end
def
starrers_sort_options_hash
{
sort_value_name
=>
sort_title_name
,
...
...
app/views/groups/runners/_sort_dropdown.html.haml
View file @
0266e1b3
-
sorted_by
=
sort_options_hash
[
@sort
]
||
sort_title_created_date
-
runners_sort_options
=
runners_sort_options_hash
.
map
{
|
value
,
text
|
{
value:
value
,
text:
text
,
href:
page_filter_path
(
sort:
value
)
}
}
.dropdown.inline.gl-ml-3
%button
.dropdown-menu-toggle
{
type:
'button'
,
data:
{
toggle:
'dropdown'
,
display:
'static'
}
}
=
sorted_by
=
sprite_icon
(
'chevron-down'
,
css_class:
'dropdown-menu-toggle-icon gl-top-3'
)
%ul
.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort
%li
=
sortable_item
(
sort_title_created_date
,
page_filter_path
(
sort:
sort_value_created_date
),
sorted_by
)
=
sortable_item
(
sort_title_contacted_date
,
page_filter_path
(
sort:
sort_value_contacted_date
),
sorted_by
)
=
gl_redirect_listbox_tag
runners_sort_options
,
@sort
,
class:
'gl-ml-3'
,
data:
{
display:
'static'
}
ee/spec/helpers/ee/sorting_helper_spec.rb
View file @
0266e1b3
...
...
@@ -13,4 +13,11 @@ RSpec.describe SortingHelper do
expect
(
sort_direction_icon
(
'last_joined'
)).
to
eq
(
'sort-highest'
)
end
end
describe
'#runners_sort_options_hash'
do
it
'behaves like non-ee for other sort values'
do
expect
(
runners_sort_options_hash
[
'created_date'
]).
to
eq
(
'Created date'
)
expect
(
runners_sort_options_hash
[
'contacted_asc'
]).
to
eq
(
'Last Contact'
)
end
end
end
spec/views/groups/runners/_sort_dropdown.html.haml_spec.rb
View file @
0266e1b3
...
...
@@ -4,27 +4,22 @@ require 'spec_helper'
RSpec
.
describe
'groups/runners/sort_dropdown.html.haml'
do
describe
'render'
do
let_it_be
(
:sort_options_hash
)
{
{
by_title:
'Title'
}
}
let_it_be
(
:sort_title_created_date
)
{
'Created date'
}
before
do
allow
(
view
).
to
receive
(
:sort
).
and_return
(
'by_title'
)
end
describe
'when a sort option is not selected'
do
it
'renders a default sort option'
do
render
'groups/runners/sort_dropdown'
,
sort_options_hash:
sort_options_hash
,
sort_title_created_date:
sort_title_created_date
render
'groups/runners/sort_dropdown'
expect
(
rendered
).
to
have_content
'Created date'
expect
(
rendered
).
to
have_content
_
(
'Created date'
)
end
end
describe
'when a sort option is selected'
do
it
'renders the selected sort option'
do
@sort
=
:by_title
render
'groups/runners/sort_dropdown'
,
sort_options_hash:
sort_options_hash
,
sort_title_created_date:
sort_title_created_date
before
do
assign
(
:sort
,
'contacted_asc'
)
render
'groups/runners/sort_dropdown'
end
expect
(
rendered
).
to
have_content
'Title'
it
'renders the selected sort option'
do
expect
(
rendered
).
to
have_content
_
(
'Last Contact'
)
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