Mercurial > hg > soundsoftware-site
comparison app/controllers/projects_controller.rb @ 131:513e61d1b4da cannam-pre-20110113-merge
Start work on paginating and refining project list layout
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Mon, 17 Jan 2011 17:22:39 +0000 |
parents | 94944d00e43c |
children | ab611b7c7ecc |
comparison
equal
deleted
inserted
replaced
130:db0caa9f0ff4 | 131:513e61d1b4da |
---|---|
43 helper :queries | 43 helper :queries |
44 include QueriesHelper | 44 include QueriesHelper |
45 helper :repositories | 45 helper :repositories |
46 include RepositoriesHelper | 46 include RepositoriesHelper |
47 include ProjectsHelper | 47 include ProjectsHelper |
48 | 48 |
49 # Lists visible projects | 49 # Lists visible projects |
50 def index | 50 def index |
51 respond_to do |format| | 51 respond_to do |format| |
52 format.html { | 52 format.html { |
53 @projects = Project.visible.find(:all, :order => 'lft') | 53 @limit = per_page_option |
54 @project_count = Project.visible.count | |
55 @project_pages = Paginator.new self, @project_count, @limit, params['page'] | |
56 @offset ||= @project_pages.current.offset | |
57 @projects = Project.visible.all(:offset => @offset, :limit => @limit, :order => 'lft') | |
58 if User.current.logged? | |
59 @user_projects = User.current.projects | |
60 end | |
61 render :template => 'projects/index.rhtml', :layout => !request.xhr? | |
54 } | 62 } |
55 format.xml { | 63 format.xml { |
56 @projects = Project.visible.find(:all, :order => 'lft') | 64 @projects = Project.visible.find(:all, :order => 'lft') |
57 } | 65 } |
58 format.atom { | 66 format.atom { |