comparison app/controllers/projects_controller.rb @ 132:ab611b7c7ecc cannam-pre-20110113-merge

Make the project list into a sortable table with a little more information in it
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Tue, 18 Jan 2011 17:02:06 +0000
parents 513e61d1b4da
children 1890a968b404
comparison
equal deleted inserted replaced
131:513e61d1b4da 132:ab611b7c7ecc
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 sort_init 'lft'
54 sort_update %w(lft title created_on updated_on)
53 @limit = per_page_option 55 @limit = per_page_option
54 @project_count = Project.visible.count 56 @project_count = Project.visible.count
55 @project_pages = Paginator.new self, @project_count, @limit, params['page'] 57 @project_pages = Paginator.new self, @project_count, @limit, params['page']
56 @offset ||= @project_pages.current.offset 58 @offset ||= @project_pages.current.offset
57 @projects = Project.visible.all(:offset => @offset, :limit => @limit, :order => 'lft') 59 @projects = Project.visible.all(:offset => @offset, :limit => @limit, :order => sort_clause)
58 if User.current.logged? 60 if User.current.logged?
59 @user_projects = User.current.projects 61 @user_projects = User.current.projects
60 end 62 end
61 render :template => 'projects/index.rhtml', :layout => !request.xhr? 63 render :template => 'projects/index.rhtml', :layout => !request.xhr?
62 } 64 }