comparison app/controllers/projects_controller.rb @ 124:bc91f2025d05 cannam

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 605adf7e1735
children ca48d8b6f55d
comparison
equal deleted inserted replaced
123:605adf7e1735 124:bc91f2025d05
45 45
46 # Lists visible projects 46 # Lists visible projects
47 def index 47 def index
48 respond_to do |format| 48 respond_to do |format|
49 format.html { 49 format.html {
50 sort_init 'lft'
51 sort_update %w(lft title created_on updated_on)
50 @limit = per_page_option 52 @limit = per_page_option
51 @project_count = Project.visible.count 53 @project_count = Project.visible.count
52 @project_pages = Paginator.new self, @project_count, @limit, params['page'] 54 @project_pages = Paginator.new self, @project_count, @limit, params['page']
53 @offset ||= @project_pages.current.offset 55 @offset ||= @project_pages.current.offset
54 @projects = Project.visible.all(:offset => @offset, :limit => @limit, :order => 'lft') 56 @projects = Project.visible.all(:offset => @offset, :limit => @limit, :order => sort_clause)
55 if User.current.logged? 57 if User.current.logged?
56 @user_projects = User.current.projects 58 @user_projects = User.current.projects
57 end 59 end
58 render :template => 'projects/index.rhtml', :layout => !request.xhr? 60 render :template => 'projects/index.rhtml', :layout => !request.xhr?
59 } 61 }