Preliminary defer buttons

This commit is contained in:
epall 2008-06-16 22:37:44 -07:00 committed by Eric Allen
parent 1d64ca0f34
commit 539fda21dc
4 changed files with 25 additions and 2 deletions

View file

@ -384,7 +384,21 @@ class TodosController < ApplicationController
end
end
private
def defer
@source_view = params['_source_view'] || 'todo'
numdays = params['days'].to_i
@todo = Todo.find(params[:id])
@todo.show_from = (@todo.show_from || Time.now.to_date) + numdays.days
@saved = @todo.save
respond_to do |format|
format.html { redirect_to :back }
format.js {render :action => 'update'}
end
end
private
def get_todo_from_params
@todo = current_user.todos.find(params['id'])