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
Boxiang Sun
gitlab-ce
Commits
2940785c
Commit
2940785c
authored
Jan 14, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sort dropdown to merge requests list
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
2c071314
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
0 deletions
+7
-0
app/contexts/merge_requests_load_context.rb
app/contexts/merge_requests_load_context.rb
+3
-0
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-0
app/views/projects/merge_requests/index.html.haml
app/views/projects/merge_requests/index.html.haml
+2
-0
No files found.
app/contexts/merge_requests_load_context.rb
View file @
2940785c
...
@@ -30,6 +30,9 @@ class MergeRequestsLoadContext < BaseContext
...
@@ -30,6 +30,9 @@ class MergeRequestsLoadContext < BaseContext
merge_requests
=
merge_requests
.
where
(
milestone_id:
(
params
[
:milestone_id
]
==
'0'
?
nil
:
params
[
:milestone_id
]))
merge_requests
=
merge_requests
.
where
(
milestone_id:
(
params
[
:milestone_id
]
==
'0'
?
nil
:
params
[
:milestone_id
]))
end
end
# Sort by :sort param
merge_requests
=
merge_requests
.
sort
(
params
[
:sort
])
merge_requests
merge_requests
end
end
end
end
app/controllers/projects/merge_requests_controller.rb
View file @
2940785c
...
@@ -17,6 +17,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -17,6 +17,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_filter
:authorize_modify_merge_request!
,
only:
[
:close
,
:edit
,
:update
,
:sort
]
before_filter
:authorize_modify_merge_request!
,
only:
[
:close
,
:edit
,
:update
,
:sort
]
def
index
def
index
sort_param
=
params
[
:sort
]
||
'newest'
@sort
=
sort_param
.
humanize
unless
sort_param
.
empty?
@merge_requests
=
MergeRequestsLoadContext
.
new
(
project
,
current_user
,
params
).
execute
@merge_requests
=
MergeRequestsLoadContext
.
new
(
project
,
current_user
,
params
).
execute
assignee_id
,
milestone_id
=
params
[
:assignee_id
],
params
[
:milestone_id
]
assignee_id
,
milestone_id
=
params
[
:assignee_id
],
params
[
:milestone_id
]
@assignee
=
@project
.
team
.
find
(
assignee_id
)
if
assignee_id
.
present?
&&
!
assignee_id
.
to_i
.
zero?
@assignee
=
@project
.
team
.
find
(
assignee_id
)
if
assignee_id
.
present?
&&
!
assignee_id
.
to_i
.
zero?
...
...
app/views/projects/merge_requests/index.html.haml
View file @
2940785c
...
@@ -60,6 +60,8 @@
...
@@ -60,6 +60,8 @@
%strong
=
milestone
.
title
%strong
=
milestone
.
title
%small
.light
=
milestone
.
expires_at
%small
.light
=
milestone
.
expires_at
=
render
'shared/sort_dropdown'
%ul
.well-list.mr-list
%ul
.well-list.mr-list
=
render
@merge_requests
=
render
@merge_requests
-
if
@merge_requests
.
blank?
-
if
@merge_requests
.
blank?
...
...
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