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'])

View file

@ -280,4 +280,8 @@ module TodosHelper
image_tag("blank.png", :title =>"Star action", :class => class_str)
end
def defer_link(days)
link_to_remote "+#{days}", :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => days, :_source_view => @source_view.underscore.gsub(/\s+/,'_')}
end
end

View file

@ -18,6 +18,7 @@
<%= deferred_due_date %>
<%= project_and_context_links( parent_container_type, :suppress_context => suppress_context, :suppress_project => suppress_project ) %>
<%= render(:partial => "todos/toggle_notes", :locals => { :item => todo }) if todo.notes? %>
<span class="defer-container"><%= defer_link(1) %> <%= defer_link(7) %></span>
</div>
</div>
<div id="<%= dom_id(todo, 'edit') %>" class="edit-form" style="display:none">

View file

@ -1200,4 +1200,8 @@ body.integrations textarea {
padding:3px;
width:80%;
background-color:#ddd;
}
}
.defer-container {
position: absolute;
right: 2px;
}