diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index 480744fb..81f52b62 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -230,6 +230,23 @@ class TodosController < ApplicationController end end + def change_context + @todo = Todo.find(params[:todo][:id]) + @original_item_context_id = @todo.context_id + @context = Context.find(params[:todo][:context_id]) + @todo.context = @context + @saved = @todo.save + + @context_changed = true + @message = "Context changed to #{@context.name}" + determine_remaining_in_context_count(@original_item_context_id) + + respond_to do |format| + format.js {render :action => :update } + format.xml { render :xml => @todo.to_xml( :except => :user_id ) } + end + end + def update @source_view = params['_source_view'] || 'todo' init_data_for_sidebar unless mobile? diff --git a/app/views/contexts/_context.rhtml b/app/views/contexts/_context.rhtml index 7b33ee9a..105b66bb 100644 --- a/app/views/contexts/_context.rhtml +++ b/app/views/contexts/_context.rhtml @@ -10,11 +10,11 @@ <%= link_to_context( context ) %> <% end %> +

Currently there are no incomplete actions in this context

<%= render :partial => "todos/todo", :collection => @not_done, :locals => { :parent_container_type => "context" } %>
-
diff --git a/app/views/todos/update.js.rjs b/app/views/todos/update.js.rjs index d15595f5..bcc80ccc 100644 --- a/app/views/todos/update.js.rjs +++ b/app/views/todos/update.js.rjs @@ -4,6 +4,7 @@ if @saved status_message += ' to tickler' if @todo.deferred? status_message = 'Added new project / ' + status_message if @new_project_created status_message = 'Added new context / ' + status_message if @new_context_created + status_message = @message || status_message page.notify :notice, status_message, 5.0 if source_view_is_one_of(:todo, :context, :tag) @@ -46,12 +47,18 @@ if @saved page.replace_html("badge_count", @down_count) if source_view_is :todo # show todo in context - page.delay(0.5) do + page.delay(0.3) do page.call "todoItems.ensureContainerHeight", "c#{@original_item_context_id}items" if source_view_is_one_of(:todo, :tag) && @todo.active? page.call "todoItems.ensureContainerHeight", "c#{@todo.context_id}items" page.visual_effect :highlight, dom_id(@todo), :duration => 3 end + if @context_changed + source_view do |from| + from.todo {page << "$('#c#{@todo.context_id} h2').effect('highlight', {}, 3000)" } + from.tag {page << "$('#c#{@todo.context_id} h2').effect('highlight')" } + end + end end else if @original_item_was_deferred && source_view_is(:tag) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 4b025f51..52acc10f 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -259,9 +259,8 @@ function enable_rich_interaction(){ ui.draggable.remove(); target.block({message: null}); setTimeout(function() {target.show()}, 0); - $.post(relative_to_root('todos/update'), - {id: dragged_todo, - "todo[id]": dragged_todo, + $.post(relative_to_root('todos/change_context'), + {"todo[id]": dragged_todo, "todo[context_id]": context_id}, function(){target.unblock(); target.hide();}, 'script'); } diff --git a/public/stylesheets/standard.css b/public/stylesheets/standard.css index 7d2963cc..069a6ce0 100644 --- a/public/stylesheets/standard.css +++ b/public/stylesheets/standard.css @@ -951,7 +951,7 @@ div.message { .context_target { height: 15px; margin: 4px; - border: thick dotted #CCC; + border: 4px dotted #999; } .context_target.hover {