Fix an issue causing the Dashboard/Milestones page to be blank
This commit is contained in:
parent
703f7c5d57
commit
7dc16346bb
7 changed files with 20 additions and 39 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue