Merge branch 'defer_buttons' of git://github.com/epall/tracks into master

This commit is contained in:
Eric Allen 2008-09-21 11:59:35 -07:00
commit 383328fab6
8 changed files with 29 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 || @todo.user.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 image_tag("defer_#{days}.png"), :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => days, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}
end
end

View file

@ -11,6 +11,7 @@
<%= remote_star_icon %>
<%= remote_toggle_checkbox unless source_view_is :deferred %>
<div class="description<%= staleness_class( todo ) %>">
<% unless @todo.completed? %><span class="defer-container"><%= defer_link(1) %> <%= defer_link(7) %></span><% end %>
<%= date_span -%>
<span class="todo.descr"><%= h sanitize(todo.description) %></span>
<%= link_to(image_tag("recurring16x16.png"), {:controller => "recurring_todos", :action => "index"}, :class => "recurring_icon") if @todo.from_recurring_todo? %>