diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index ac0c251a..3f36f194 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -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']) diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index ec70762e..b989b432 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -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 diff --git a/app/views/todos/_todo.html.erb b/app/views/todos/_todo.html.erb index c03e64e6..288325a0 100644 --- a/app/views/todos/_todo.html.erb +++ b/app/views/todos/_todo.html.erb @@ -11,6 +11,7 @@ <%= remote_star_icon %> <%= remote_toggle_checkbox unless source_view_is :deferred %>
+ <% unless @todo.completed? %><%= defer_link(1) %> <%= defer_link(7) %><% end %> <%= date_span -%> <%= h sanitize(todo.description) %> <%= link_to(image_tag("recurring16x16.png"), {:controller => "recurring_todos", :action => "index"}, :class => "recurring_icon") if @todo.from_recurring_todo? %> diff --git a/public/images/defer_1.png b/public/images/defer_1.png new file mode 100644 index 00000000..d40a9c01 Binary files /dev/null and b/public/images/defer_1.png differ diff --git a/public/images/defer_7.png b/public/images/defer_7.png new file mode 100644 index 00000000..7e80ff15 Binary files /dev/null and b/public/images/defer_7.png differ diff --git a/public/javascripts/tracks_1219672692.js b/public/javascripts/tracks_1220755978.js similarity index 100% rename from public/javascripts/tracks_1219672692.js rename to public/javascripts/tracks_1220755978.js diff --git a/public/stylesheets/standard.css b/public/stylesheets/standard.css index 0a5b9516..3b31fcd7 100644 --- a/public/stylesheets/standard.css +++ b/public/stylesheets/standard.css @@ -1200,4 +1200,10 @@ body.integrations textarea { padding:3px; width:80%; background-color:#ddd; -} \ No newline at end of file +} +.defer-container { + float:right; +} +.defer-container a:hover { + background-color: inherit; +} diff --git a/public/stylesheets/tracks_1219763287.css b/public/stylesheets/tracks_1220796176.css similarity index 99% rename from public/stylesheets/tracks_1219763287.css rename to public/stylesheets/tracks_1220796176.css index c2d06198..446d9b87 100644 --- a/public/stylesheets/tracks_1219763287.css +++ b/public/stylesheets/tracks_1220796176.css @@ -220,6 +220,8 @@ body.integrations h2 {margin-top:40px; padding-top:20px; margin-bottom:10px; bor body.integrations p, body.integrations li {font-size:1.0em} body.integrations li {list-style-type: disc; list-style-position: inside; margin-left:30px} body.integrations textarea {margin:10px; padding:3px; width:80%; background-color:#ddd} +.defer-container {float:right} +.defer-container a:hover {background-color: inherit} div.calendar {position: relative} .calendar, .calendar table {border: 1px solid #556; font-size: 11px; color: #000; cursor: default; background: #eef; z-index: 110; font-family: tahoma,verdana,sans-serif} .calendar .button {text-align: center; padding: 2px}