comparison app/controllers/projects_controller.rb @ 443:350acce374a2 cannam

Merge from branch "cannam-pre-20110113-merge"
author Chris Cannam
date Mon, 06 Jun 2011 14:55:38 +0100
parents 753f1380d6bc a9921f3e9088
children 851510f1b535
comparison
equal deleted inserted replaced
442:753f1380d6bc 443:350acce374a2
54 @project_count = Project.visible_roots.count 54 @project_count = Project.visible_roots.count
55 @project_pages = Paginator.new self, @project_count, @limit, params['page'] 55 @project_pages = Paginator.new self, @project_count, @limit, params['page']
56 @offset ||= @project_pages.current.offset 56 @offset ||= @project_pages.current.offset
57 @projects = Project.visible_roots.all(:offset => @offset, :limit => @limit, :order => sort_clause) 57 @projects = Project.visible_roots.all(:offset => @offset, :limit => @limit, :order => sort_clause)
58 if User.current.logged? 58 if User.current.logged?
59 @user_projects = User.current.projects.sort_by(&:name) 59 # seems sort_by gives us case-sensitive ordering, which we don't want
60 # @user_projects = User.current.projects.sort_by(&:name)
61 @user_projects = User.current.projects.all(:order => :name)
60 end 62 end
61 render :template => 'projects/index.rhtml', :layout => !request.xhr? 63 render :template => 'projects/index.rhtml', :layout => !request.xhr?
62 } 64 }
63 format.api { 65 format.api {
64 @offset, @limit = api_offset_and_limit 66 @offset, @limit = api_offset_and_limit
213 end 215 end
214 end 216 end
215 end 217 end
216 218
217 verify :method => :post, :only => :modules, :render => {:nothing => true, :status => :method_not_allowed } 219 verify :method => :post, :only => :modules, :render => {:nothing => true, :status => :method_not_allowed }
220
221 def overview
222 @project.has_welcome_page = params[:has_welcome_page]
223 if @project.save
224 flash[:notice] = l(:notice_successful_update)
225 end
226 redirect_to :action => 'settings', :id => @project, :tab => 'overview'
227 end
228
218 def modules 229 def modules
219 @project.enabled_module_names = params[:enabled_module_names] 230 @project.enabled_module_names = params[:enabled_module_names]
220 flash[:notice] = l(:notice_successful_update) 231 flash[:notice] = l(:notice_successful_update)
221 redirect_to :action => 'settings', :id => @project, :tab => 'modules' 232 redirect_to :action => 'settings', :id => @project, :tab => 'modules'
222 end 233 end