BigW Consortium Gitlab

Commit 7dc16346 by Rémy Coutable

Fix an issue causing the Dashboard/Milestones page to be blank

parent 703f7c5d
...@@ -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
......
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
...@@ -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
...@@ -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
...@@ -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
......
...@@ -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
......
...@@ -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]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment