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
7dc16346
Commit
7dc16346
authored
Mar 22, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix an issue causing the Dashboard/Milestones page to be blank
parent
703f7c5d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
39 deletions
+20
-39
app/controllers/concerns/global_milestones.rb
app/controllers/concerns/global_milestones.rb
+4
-1
app/controllers/dashboard/application_controller.rb
app/controllers/dashboard/application_controller.rb
+6
-0
app/controllers/dashboard/milestones_controller.rb
app/controllers/dashboard/milestones_controller.rb
+6
-6
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+1
-28
app/helpers/labels_helper.rb
app/helpers/labels_helper.rb
+1
-1
app/helpers/milestones_helper.rb
app/helpers/milestones_helper.rb
+1
-1
config/routes.rb
config/routes.rb
+1
-2
No files found.
app/controllers/concerns/global_milestones.rb
View file @
7dc16346
...
@@ -6,7 +6,10 @@ module GlobalMilestones
...
@@ -6,7 +6,10 @@ module GlobalMilestones
@milestones
=
MilestonesFinder
.
new
.
execute
(
@projects
,
params
)
@milestones
=
MilestonesFinder
.
new
.
execute
(
@projects
,
params
)
@milestones
=
GlobalMilestone
.
build_collection
(
@milestones
)
@milestones
=
GlobalMilestone
.
build_collection
(
@milestones
)
@milestones
=
@milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
@milestones
=
@milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
@milestones
=
Kaminari
.
paginate_array
(
@milestones
).
page
(
params
[
:page
])
if
request
.
format
==
:html
@milestones
=
Kaminari
.
paginate_array
(
@milestones
).
page
(
params
[
:page
])
end
end
end
def
milestone
def
milestone
...
...
app/controllers/dashboard/application_controller.rb
View file @
7dc16346
class
Dashboard::ApplicationController
<
ApplicationController
class
Dashboard::ApplicationController
<
ApplicationController
layout
'dashboard'
layout
'dashboard'
private
def
projects
@projects
||=
current_user
.
authorized_projects
.
sorted_by_activity
.
non_archived
end
end
end
app/controllers/dashboard/milestones_controller.rb
View file @
7dc16346
...
@@ -6,14 +6,14 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController
...
@@ -6,14 +6,14 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController
before_action
:milestone
,
only:
[
:show
]
before_action
:milestone
,
only:
[
:show
]
def
index
def
index
respond_to
do
|
format
|
format
.
html
format
.
json
do
render
json:
@milestones
end
end
end
end
def
show
def
show
end
end
private
def
projects
@projects
||=
current_user
.
authorized_projects
.
sorted_by_activity
.
non_archived
end
end
end
app/controllers/dashboard_controller.rb
View file @
7dc16346
...
@@ -3,7 +3,7 @@ class DashboardController < Dashboard::ApplicationController
...
@@ -3,7 +3,7 @@ class DashboardController < Dashboard::ApplicationController
include
MergeRequestsAction
include
MergeRequestsAction
before_action
:event_filter
,
only: :activity
before_action
:event_filter
,
only: :activity
before_action
:projects
,
only:
[
:issues
,
:merge_requests
,
:labels
,
:milestones
]
before_action
:projects
,
only:
[
:issues
,
:merge_requests
]
respond_to
:html
respond_to
:html
...
@@ -20,29 +20,6 @@ class DashboardController < Dashboard::ApplicationController
...
@@ -20,29 +20,6 @@ class DashboardController < Dashboard::ApplicationController
end
end
end
end
def
labels
labels
=
Label
.
where
(
project_id:
@projects
).
select
(
:title
,
:color
).
uniq
(
:title
)
respond_to
do
|
format
|
format
.
json
do
render
json:
labels
end
end
end
def
milestones
milestones
=
Milestone
.
where
(
project_id:
@projects
).
active
epoch
=
DateTime
.
parse
(
'1970-01-01'
)
grouped_milestones
=
GlobalMilestone
.
build_collection
(
milestones
)
grouped_milestones
=
grouped_milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
respond_to
do
|
format
|
format
.
json
do
render
json:
grouped_milestones
end
end
end
protected
protected
def
load_events
def
load_events
...
@@ -57,8 +34,4 @@ class DashboardController < Dashboard::ApplicationController
...
@@ -57,8 +34,4 @@ class DashboardController < Dashboard::ApplicationController
@events
=
@event_filter
.
apply_filter
(
@events
).
with_associations
@events
=
@event_filter
.
apply_filter
(
@events
).
with_associations
@events
=
@events
.
limit
(
20
).
offset
(
params
[
:offset
]
||
0
)
@events
=
@events
.
limit
(
20
).
offset
(
params
[
:offset
]
||
0
)
end
end
def
projects
@projects
||=
current_user
.
authorized_projects
.
sorted_by_activity
.
non_archived
end
end
end
app/helpers/labels_helper.rb
View file @
7dc16346
...
@@ -114,7 +114,7 @@ module LabelsHelper
...
@@ -114,7 +114,7 @@ module LabelsHelper
if
@project
if
@project
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:json
)
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:json
)
else
else
labels_dashboard
_path
(
:json
)
dashboard_labels
_path
(
:json
)
end
end
end
end
...
...
app/helpers/milestones_helper.rb
View file @
7dc16346
...
@@ -50,7 +50,7 @@ module MilestonesHelper
...
@@ -50,7 +50,7 @@ module MilestonesHelper
if
@project
if
@project
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
)
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
)
else
else
milestones_dashboard
_path
(
:json
)
dashboard_milestones
_path
(
:json
)
end
end
end
end
...
...
config/routes.rb
View file @
7dc16346
...
@@ -351,11 +351,10 @@ Rails.application.routes.draw do
...
@@ -351,11 +351,10 @@ Rails.application.routes.draw do
get
:issues
get
:issues
get
:merge_requests
get
:merge_requests
get
:activity
get
:activity
get
:labels
get
:milestones
scope
module: :dashboard
do
scope
module: :dashboard
do
resources
:milestones
,
only:
[
:index
,
:show
]
resources
:milestones
,
only:
[
:index
,
:show
]
resources
:labels
,
only:
[
:index
]
resources
:groups
,
only:
[
:index
]
resources
:groups
,
only:
[
:index
]
resources
:snippets
,
only:
[
:index
]
resources
:snippets
,
only:
[
:index
]
...
...
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