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
9109a339
Commit
9109a339
authored
Nov 27, 2018
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix roadmaps controller and add some specs
parent
6374e999
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
6 deletions
+31
-6
app/controllers/concerns/issuable_collections.rb
app/controllers/concerns/issuable_collections.rb
+5
-1
ee/app/controllers/concerns/epics_actions.rb
ee/app/controllers/concerns/epics_actions.rb
+2
-0
ee/app/controllers/groups/roadmap_controller.rb
ee/app/controllers/groups/roadmap_controller.rb
+5
-1
ee/app/helpers/ee/sorting_helper.rb
ee/app/helpers/ee/sorting_helper.rb
+1
-0
ee/spec/controllers/groups/roadmap_controller_spec.rb
ee/spec/controllers/groups/roadmap_controller_spec.rb
+18
-4
No files found.
app/controllers/concerns/issuable_collections.rb
View file @
9109a339
...
...
@@ -91,7 +91,7 @@ module IssuableCollections
options
=
{
scope:
params
[
:scope
],
state:
params
[
:state
],
sort:
set_sort_order
_from_user_preference
||
set_sort_order_from_cookie
||
default_sort_order
sort:
set_sort_order
}
# Used by view to highlight active option
...
...
@@ -113,6 +113,10 @@ module IssuableCollections
'opened'
end
def
set_sort_order
set_sort_order_from_user_preference
||
set_sort_order_from_cookie
||
default_sort_order
end
def
set_sort_order_from_user_preference
return
unless
current_user
return
unless
issuable_sorting_field
...
...
ee/app/controllers/concerns/epics_actions.rb
View file @
9109a339
...
...
@@ -16,6 +16,8 @@ module EpicsActions
def
update_cookie_value
(
value
)
case
value
when
'created_asc'
then
sort_value_oldest_created
when
'created_desc'
then
sort_value_recently_created
when
'start_date_asc'
then
sort_value_start_date
when
'end_date_asc'
then
sort_value_end_date
else
...
...
ee/app/controllers/groups/roadmap_controller.rb
View file @
9109a339
...
...
@@ -10,13 +10,17 @@ module Groups
# show roadmap for a group
def
show
# Used only to show to correct sort dropdown option on filter bar
@sort
=
params
[
:sort
]
||
current_user
&
.
user_preference
&
.
epics_sort
||
defaul
t_sort_order
@sort
=
se
t_sort_order
@epics_count
=
EpicsFinder
.
new
(
current_user
,
group_id:
@group
.
id
).
execute
.
count
end
private
def
issuable_sorting_field
:epics_sort
end
def
persist_roadmap_layout
return
unless
current_user
...
...
ee/app/helpers/ee/sorting_helper.rb
View file @
9109a339
...
...
@@ -16,6 +16,7 @@ module EE
def
epics_sort_options_hash
{
sort_value_created_date
=>
sort_title_created_date
,
sort_value_oldest_created
=>
sort_title_created_date
,
sort_value_recently_created
=>
sort_title_created_date
,
sort_value_oldest_updated
=>
sort_title_recently_updated
,
...
...
ee/spec/controllers/groups/roadmap_controller_spec.rb
View file @
9109a339
...
...
@@ -31,11 +31,25 @@ describe Groups::RoadmapController do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
it
'stores sorting param in a cookie'
do
get
:show
,
group_id:
group
,
sort:
'start_date_asc'
context
'when user is logged in'
do
it
'stores sorting param in a cookie'
do
group
.
update!
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
sign_out
(
user
)
expect
(
cookies
[
'epic_sort'
]).
to
eq
(
'start_date_asc'
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
get
:show
,
group_id:
group
,
sort:
'start_date_asc'
expect
(
cookies
[
'epic_sort'
]).
to
eq
(
'start_date_asc'
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
end
context
'when there is no user logged in'
do
it
'stores sorting param in a cookie'
do
get
:show
,
group_id:
group
,
sort:
'start_date_asc'
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
user
.
reload
.
user_preference
.
epics_sort
).
to
eq
(
'start_date_asc'
)
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