Add projects page to dashboard. Remove projects pagination on dashboard
This commit is contained in:
parent
b68bba441e
commit
bd3b677b86
5 changed files with 71 additions and 24 deletions
|
@ -1,26 +1,15 @@
|
|||
class DashboardController < ApplicationController
|
||||
respond_to :html
|
||||
|
||||
before_filter :projects
|
||||
before_filter :load_projects
|
||||
before_filter :event_filter, only: :index
|
||||
|
||||
def index
|
||||
@groups = current_user.authorized_groups
|
||||
|
||||
@has_authorized_projects = @projects.count > 0
|
||||
|
||||
@projects = case params[:scope]
|
||||
when 'personal' then
|
||||
@projects.personal(current_user)
|
||||
when 'joined' then
|
||||
@projects.joined(current_user)
|
||||
else
|
||||
@projects
|
||||
end
|
||||
|
||||
@teams = current_user.authorized_teams
|
||||
|
||||
@projects = @projects.page(params[:page]).per(30)
|
||||
@projects_count = @projects.count
|
||||
@projects = @projects.limit(20)
|
||||
|
||||
@events = Event.in_projects(current_user.authorized_projects.pluck(:id))
|
||||
@events = @event_filter.apply_filter(@events)
|
||||
|
@ -35,6 +24,19 @@ class DashboardController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def projects
|
||||
@projects = case params[:scope]
|
||||
when 'personal' then
|
||||
@projects.personal(current_user)
|
||||
when 'joined' then
|
||||
@projects.joined(current_user)
|
||||
else
|
||||
@projects
|
||||
end
|
||||
|
||||
@projects = @projects.page(params[:page]).per(30)
|
||||
end
|
||||
|
||||
# Get authored or assigned open merge requests
|
||||
def merge_requests
|
||||
@merge_requests = current_user.cared_merge_requests
|
||||
|
@ -57,7 +59,7 @@ class DashboardController < ApplicationController
|
|||
|
||||
protected
|
||||
|
||||
def projects
|
||||
def load_projects
|
||||
@projects = current_user.authorized_projects.sorted_by_activity
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue