Class Cms::TasksController
In: app/controllers/cms/tasks_controller.rb
Parent: Cms::BaseController

Methods

complete   create   new  

Public Instance methods

[Source]

    # File app/controllers/cms/tasks_controller.rb, line 21
21:   def complete
22:     if params[:task_ids]
23:       Task.all(:conditions => ["id in (?)", params[:task_ids]]).each do |t|
24:         if t.assigned_to == current_user
25:           t.mark_as_complete!
26:         end
27:       end
28:       flash[:notice] = "Tasks marked as complete"
29:       redirect_to cms_dashboard_path
30:     else
31:       @task = Task.find(params[:id])
32:       if @task.assigned_to == current_user
33:         if @task.mark_as_complete!
34:           flash[:notice] = "Task was marked as complete"
35:         end
36:       else
37:         flash[:error] = "You cannot complete tasks that are not assigned to you"
38:       end
39:       redirect_to @task.page.path
40:     end
41:   end

[Source]

    # File app/controllers/cms/tasks_controller.rb, line 10
10:   def create
11:     @task = @page.tasks.build(params[:task])
12:     @task.assigned_by = current_user
13:     if @task.save
14:       flash[:notice] = "Page was assigned to '#{@task.assigned_to.login}'"
15:       redirect_to @page.path
16:     else
17:       render :action => 'new'
18:     end
19:   end

[Source]

   # File app/controllers/cms/tasks_controller.rb, line 6
6:   def new
7:     @task = @page.tasks.build(:assigned_by => current_user)
8:   end

[Validate]