Dashboard perfomance improved. Filter for projects page

This commit is contained in:
Dmitriy Zaporozhets 2011-12-20 08:24:14 +02:00
parent 6d5c969872
commit cff9519127
16 changed files with 215 additions and 112 deletions

View file

@ -3,7 +3,7 @@ class DashboardController < ApplicationController
def index
@projects = current_user.projects.all
@active_projects = @projects.select(&:last_activity_date).sort_by(&:last_activity_date).reverse
@active_projects = @projects.select(&:last_activity_date_cached).sort_by(&:last_activity_date_cached).reverse
respond_to do |format|
format.html

View file

@ -11,9 +11,10 @@ class ProjectsController < ApplicationController
before_filter :require_non_empty_project, :only => [:blob, :tree, :graph]
def index
source = current_user.projects
source = source.tagged_with(params[:tag]) unless params[:tag].blank?
@projects = source.all
@limit, @offset = (params[:limit] || 16), (params[:offset] || 0)
@projects = current_user.projects
@projects = @projects.where("name LIKE ?", "%#{params[:terms]}%") unless params[:terms].blank?
@projects = @projects.limit(@limit).offset(@offset)
end
def new