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
e989d12b
Commit
e989d12b
authored
Mar 23, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use respond_to instead of a conditional to paginate milestones
parent
7dc16346
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
+9
-8
app/controllers/concerns/global_milestones.rb
app/controllers/concerns/global_milestones.rb
+0
-4
app/controllers/dashboard/milestones_controller.rb
app/controllers/dashboard/milestones_controller.rb
+4
-3
app/controllers/groups/milestones_controller.rb
app/controllers/groups/milestones_controller.rb
+5
-1
No files found.
app/controllers/concerns/global_milestones.rb
View file @
e989d12b
...
...
@@ -6,10 +6,6 @@ module GlobalMilestones
@milestones
=
MilestonesFinder
.
new
.
execute
(
@projects
,
params
)
@milestones
=
GlobalMilestone
.
build_collection
(
@milestones
)
@milestones
=
@milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
if
request
.
format
==
:html
@milestones
=
Kaminari
.
paginate_array
(
@milestones
).
page
(
params
[
:page
])
end
end
def
milestone
...
...
app/controllers/dashboard/milestones_controller.rb
View file @
e989d12b
...
...
@@ -2,14 +2,15 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController
include
GlobalMilestones
before_action
:projects
before_action
:milestones
,
only:
[
:index
]
before_action
:milestone
,
only:
[
:show
]
def
index
respond_to
do
|
format
|
format
.
html
format
.
html
do
@milestones
=
Kaminari
.
paginate_array
(
milestones
).
page
(
params
[
:page
])
end
format
.
json
do
render
json:
@
milestones
render
json:
milestones
end
end
end
...
...
app/controllers/groups/milestones_controller.rb
View file @
e989d12b
...
...
@@ -2,11 +2,15 @@ class Groups::MilestonesController < Groups::ApplicationController
include
GlobalMilestones
before_action
:group_projects
before_action
:milestones
,
only:
[
:index
]
before_action
:milestone
,
only:
[
:show
,
:update
]
before_action
:authorize_admin_milestones!
,
only:
[
:new
,
:create
,
:update
]
def
index
respond_to
do
|
format
|
format
.
html
do
@milestones
=
Kaminari
.
paginate_array
(
milestones
).
page
(
params
[
:page
])
end
end
end
def
new
...
...
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