summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-03-22 19:19:53 +0100
committerRémy Coutable <remy@rymai.me>2016-03-23 12:02:15 +0100
commit7dc16346bba174d6075cf438adcd70a5596ba935 (patch)
treebdb093b32967dae0946476747a223124ee65f09f
parent703f7c5d579a6ab6d7592c24f8e3f2813d9d1703 (diff)
downloadgitlab-ce-7dc16346bba174d6075cf438adcd70a5596ba935.tar.gz
Fix an issue causing the Dashboard/Milestones page to be blank
-rw-r--r--app/controllers/concerns/global_milestones.rb5
-rw-r--r--app/controllers/dashboard/application_controller.rb6
-rw-r--r--app/controllers/dashboard/milestones_controller.rb12
-rw-r--r--app/controllers/dashboard_controller.rb29
-rw-r--r--app/helpers/labels_helper.rb2
-rw-r--r--app/helpers/milestones_helper.rb2
-rw-r--r--config/routes.rb3
7 files changed, 20 insertions, 39 deletions
diff --git a/app/controllers/concerns/global_milestones.rb b/app/controllers/concerns/global_milestones.rb
index 54ea1e454fc..f5eace47df4 100644
--- a/app/controllers/concerns/global_milestones.rb
+++ b/app/controllers/concerns/global_milestones.rb
@@ -6,7 +6,10 @@ 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 }
- @milestones = Kaminari.paginate_array(@milestones).page(params[:page])
+
+ if request.format == :html
+ @milestones = Kaminari.paginate_array(@milestones).page(params[:page])
+ end
end
def milestone
diff --git a/app/controllers/dashboard/application_controller.rb b/app/controllers/dashboard/application_controller.rb
index 962ea38d6c9..9d3d1c23c28 100644
--- a/app/controllers/dashboard/application_controller.rb
+++ b/app/controllers/dashboard/application_controller.rb
@@ -1,3 +1,9 @@
class Dashboard::ApplicationController < ApplicationController
layout 'dashboard'
+
+ private
+
+ def projects
+ @projects ||= current_user.authorized_projects.sorted_by_activity.non_archived
+ end
end
diff --git a/app/controllers/dashboard/milestones_controller.rb b/app/controllers/dashboard/milestones_controller.rb
index 2bdce0f8a00..0a4a4088404 100644
--- a/app/controllers/dashboard/milestones_controller.rb
+++ b/app/controllers/dashboard/milestones_controller.rb
@@ -6,14 +6,14 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController
before_action :milestone, only: [:show]
def index
+ respond_to do |format|
+ format.html
+ format.json do
+ render json: @milestones
+ end
+ end
end
def show
end
-
- private
-
- def projects
- @projects ||= current_user.authorized_projects.sorted_by_activity.non_archived
- end
end
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
index b538c7d1608..1dce4a21729 100644
--- a/app/controllers/dashboard_controller.rb
+++ b/app/controllers/dashboard_controller.rb
@@ -3,7 +3,7 @@ class DashboardController < Dashboard::ApplicationController
include MergeRequestsAction
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
@@ -20,29 +20,6 @@ class DashboardController < Dashboard::ApplicationController
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
def load_events
@@ -57,8 +34,4 @@ class DashboardController < Dashboard::ApplicationController
@events = @event_filter.apply_filter(@events).with_associations
@events = @events.limit(20).offset(params[:offset] || 0)
end
-
- def projects
- @projects ||= current_user.authorized_projects.sorted_by_activity.non_archived
- end
end
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index e0a8552dfa7..3dded7c2f23 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -114,7 +114,7 @@ module LabelsHelper
if @project
namespace_project_labels_path(@project.namespace, @project, :json)
else
- labels_dashboard_path(:json)
+ dashboard_labels_path(:json)
end
end
diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb
index c9d8787bd19..87fc2db6901 100644
--- a/app/helpers/milestones_helper.rb
+++ b/app/helpers/milestones_helper.rb
@@ -50,7 +50,7 @@ module MilestonesHelper
if @project
namespace_project_milestones_path(@project.namespace, @project, :json)
else
- milestones_dashboard_path(:json)
+ dashboard_milestones_path(:json)
end
end
diff --git a/config/routes.rb b/config/routes.rb
index 90d858d7fc1..4a3c23b7c1c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -351,11 +351,10 @@ Rails.application.routes.draw do
get :issues
get :merge_requests
get :activity
- get :labels
- get :milestones
scope module: :dashboard do
resources :milestones, only: [:index, :show]
+ resources :labels, only: [:index]
resources :groups, only: [:index]
resources :snippets, only: [:index]