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
iv
gitlab-ce
Commits
7c520c78
Commit
7c520c78
authored
Jan 22, 2016
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sorting preference reusable for all projects.
parent
eccaa099
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
14 deletions
+43
-14
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+15
-6
app/models/concerns/cookie_helpers.rb
app/models/concerns/cookie_helpers.rb
+0
-5
app/models/group.rb
app/models/group.rb
+0
-1
app/models/project.rb
app/models/project.rb
+0
-1
app/models/user.rb
app/models/user.rb
+0
-1
features/dashboard/dashboard.feature
features/dashboard/dashboard.feature
+14
-0
features/project/issues/issues.feature
features/project/issues/issues.feature
+7
-0
features/project/merge_requests.feature
features/project/merge_requests.feature
+7
-0
No files found.
app/controllers/application_controller.rb
View file @
7c520c78
...
...
@@ -409,13 +409,22 @@ class ApplicationController < ActionController::Base
private
def
set_default_sort
# Use the controller name so we have a distinct cookie for Issues, MRs and Dashboard
cookie_suffix
=
"_sort_
#{
params
[
:controller
].
underscore
}
"
key
=
if
is_a_listing_page_for?
(
'issues'
)
'issues_sort'
elsif
is_a_listing_page_for?
(
'merge_requests'
)
'merge_requests_sort'
end
key
=
"
#{
(
@project
||
@group
||
current_user
).
cookie_key
}#{
cookie_suffix
}
"
cookies
[
key
]
=
params
[
:sort
]
if
key
&&
params
[
:sort
].
present?
params
[
:sort
]
=
cookies
[
key
]
if
key
params
[
:sort
]
||=
'id_desc'
end
def
is_a_listing_page_for?
(
page_type
)
controller_name
,
action_name
=
params
.
values_at
(
:controller
,
:action
)
cookies
[
key
]
||=
'id_desc'
cookies
[
key
]
=
params
[
:sort
]
if
params
[
:sort
].
present?
params
[
:sort
]
=
cookies
[
key
]
(
controller_name
==
"projects/
#{
page_type
}
"
&&
action_name
==
'index'
)
||
(
controller_name
==
'groups'
&&
action_name
==
page_type
)
||
(
controller_name
==
'dashboard'
&&
action_name
==
page_type
)
end
end
app/models/concerns/cookie_helpers.rb
deleted
100644 → 0
View file @
eccaa099
module
CookieHelpers
def
cookie_key
"
#{
model_name
.
singular
}
_
#{
id
}
"
end
end
app/models/group.rb
View file @
7c520c78
...
...
@@ -19,7 +19,6 @@ require 'file_size_validator'
class
Group
<
Namespace
include
Gitlab
::
ConfigHelper
include
Referable
include
CookieHelpers
has_many
:group_members
,
dependent: :destroy
,
as: :source
,
class_name:
'GroupMember'
alias_method
:members
,
:group_members
...
...
app/models/project.rb
View file @
7c520c78
...
...
@@ -51,7 +51,6 @@ class Project < ActiveRecord::Base
include
AfterCommitQueue
include
CaseSensitivity
include
TokenAuthenticatable
include
CookieHelpers
extend
Gitlab
::
ConfigHelper
...
...
app/models/user.rb
View file @
7c520c78
...
...
@@ -73,7 +73,6 @@ class User < ActiveRecord::Base
include
Sortable
include
CaseSensitivity
include
TokenAuthenticatable
include
CookieHelpers
add_authentication_token_field
:authentication_token
...
...
features/dashboard/dashboard.feature
View file @
7c520c78
...
...
@@ -50,6 +50,13 @@ Feature: Dashboard
And
I visit dashboard issues page
Then
The list should be sorted by
"Oldest updated"
@javascript
Scenario
:
Visiting Project's issues after sorting
Given
I visit dashboard issues page
And
I sort the list by
"Oldest updated"
And
I visit project
"Shop"
issues page
Then
The list should be sorted by
"Oldest updated"
@javascript
Scenario
:
Sorting Merge Requests
Given
I visit dashboard merge requests page
...
...
@@ -57,3 +64,10 @@ Feature: Dashboard
And
I visit dashboard activity page
And
I visit dashboard merge requests page
Then
The list should be sorted by
"Oldest updated"
@javascript
Scenario
:
Visiting Project's merge requests after sorting
Given
I visit dashboard merge requests page
And
I sort the list by
"Oldest updated"
And
I visit project
"Shop"
merge requests page
Then
The list should be sorted by
"Oldest updated"
features/project/issues/issues.feature
View file @
7c520c78
...
...
@@ -67,6 +67,13 @@ Feature: Project Issues
And
I visit project
"Shop"
issues page
Then
The list should be sorted by
"Oldest updated"
@javascript
Scenario
:
Visiting Merge Requests from a differente Project after sorting
Given
I visit project
"Shop"
merge requests page
And
I sort the list by
"Oldest updated"
And
I visit dashboard merge requests page
Then
The list should be sorted by
"Oldest updated"
@javascript
Scenario
:
I
search issue
Given
I fill in issue search with
"Re"
...
...
features/project/merge_requests.feature
View file @
7c520c78
...
...
@@ -92,6 +92,13 @@ Feature: Project Merge Requests
And
I visit project
"Shop"
merge requests page
Then
The list should be sorted by
"Oldest updated"
@javascript
Scenario
:
Visiting Merge Requests from a differente Project after sorting
Given
I visit project
"Shop"
merge requests page
And
I sort the list by
"Oldest updated"
And
I visit dashboard merge requests page
Then
The list should be sorted by
"Oldest updated"
@javascript
Scenario
:
Visiting Merge Requests after commenting on diffs
Given
project
"Shop"
have
"Bug NS-05"
open merge request with diffs inside
...
...
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