Dashboard refactoring:

* dashboard should be in dashboard controller not project index
* projects index removed
This commit is contained in:
randx 2012-06-12 23:13:42 +03:00
parent 9ef9c58f55
commit edd81a79c5
15 changed files with 84 additions and 101 deletions

View file

@ -2,18 +2,17 @@ class DashboardController < ApplicationController
respond_to :html
def index
@projects = current_user.projects.all
@projects = current_user.projects.includes(:events).order("events.created_at DESC")
@projects = @projects.page(params[:page]).per(40)
@active_projects = @projects.select(&:last_activity_date).sort_by(&:last_activity_date).reverse
@events = Event.where(:project_id => current_user.projects.map(&:id)).recent.limit(20)
@merge_requests = MergeRequest.where("author_id = :id or assignee_id = :id", :id => current_user.id).opened.order("created_at DESC").limit(5)
@last_push = current_user.recent_push
@user = current_user
@issues = current_user.assigned_issues.opened.order("created_at DESC").limit(5)
@issues = @issues.includes(:author, :project)
@events = Event.where(:project_id => @projects.map(&:id)).recent.limit(20)
@last_push = Event.where(:project_id => @projects.map(&:id)).recent.code_push.limit(1).first
respond_to do |format|
format.html
format.atom { render :layout => false }
end
end
# Get authored or assigned open merge requests