diff --git a/tracks/app/controllers/deferred_controller.rb b/tracks/app/controllers/deferred_controller.rb index a2b13a58..25360a56 100644 --- a/tracks/app/controllers/deferred_controller.rb +++ b/tracks/app/controllers/deferred_controller.rb @@ -51,7 +51,7 @@ class DeferredController < ApplicationController @source_view = 'deferred' init_projects_and_contexts @item = check_user_return_item - render :layout => false + render :template => 'todo/edit.rjs' end def update diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index da68ee6c..104c9224 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -89,7 +89,6 @@ class TodoController < ApplicationController def edit self.init @item = check_user_return_item - render :layout => false end def show @@ -125,7 +124,7 @@ class TodoController < ApplicationController # Edit the details of an action # - def update_action + def update self.init @item = check_user_return_item @original_item_context_id = @item.context_id @@ -149,7 +148,7 @@ class TodoController < ApplicationController @item.context_id = context.id @item.context = context @saved = @item.save - render :action => 'update_action' + render :action => 'update' else render :update do |page| page.replace_html "info", content_tag("div", "Error updating the context of the dragged item. Item and context user mis-match: #{@item.user.name} and #{@context.user.name}! - refresh the page to see them.", "class" => "warning") @@ -166,7 +165,7 @@ class TodoController < ApplicationController @item.project_id = project.id @item.project = project @saved = @item.save - render :action => 'update_action' + render :action => 'update' else render :update do |page| page.replace_html "info", content_tag("div", "Error updating the project of the dragged item. Item and project user mis-match: #{@item.user.name} and #{@project.user.name}! - refresh the page to see them.", "class" => "warning") diff --git a/tracks/app/helpers/todo_helper.rb b/tracks/app/helpers/todo_helper.rb index a5cbc815..7ecbb0e3 100644 --- a/tracks/app/helpers/todo_helper.rb +++ b/tracks/app/helpers/todo_helper.rb @@ -8,9 +8,8 @@ module TodoHelper end def form_remote_tag_edit_todo( item, type ) - (type == "deferred") ? act = 'update' : act = 'update_action' (type == "deferred") ? controller_name = 'deferred' : controller_name = 'todo' - form_remote_tag( :url => { :controller => controller_name, :action => act, :id => item.id }, + form_remote_tag( :url => { :controller => controller_name, :action => 'update', :id => item.id }, :html => { :id => "form-action-#{item.id}", :class => "inline-form" } ) end @@ -18,21 +17,17 @@ module TodoHelper def link_to_remote_todo( item, options = {}) (options[:type] == "deferred") ? controller_name = 'deferred' : controller_name = 'todo' url_options = { :controller => controller_name, :action => 'destroy', :id => item.id, :_source_view => @source_view } - str = link_to_remote( image_tag("blank", :title =>"Delete action", :class=>"delete_item"), + + str = link_to_remote( image_tag_for_delete, { :url => url_options, :confirm => "Are you sure that you want to delete the action, \'#{item.description}\'?" }, { :class => "icon" } ) + "\n" if !item.done? - str << link_to_remote( image_tag("blank", :title =>"Edit action", :class=>"edit_item", :id=>"action-#{item.id}-edit-icon"), - { - :update => "form-action-#{item.id}", - :loading => visual_effect(:pulsate, "action-#{item.id}-edit-icon"), - :url => { :controller => 'todo', :action => 'edit', :id => item.id, :_source_view => @source_view }, - :success => "Element.toggle('item-#{item.id}','action-#{item.id}-edit-form'); new Effect.Appear('action-#{item.id}-edit-form', { duration: .2 }); Form.focusFirstElement('form-action-#{item.id}')" - }, - { - :class => "icon" - }) + url_options[:action] = 'edit' + str << link_to_remote( image_tag_for_edit(item), + { :url => url_options, :loading => visual_effect(:pulsate, "action-#{item.id}-edit-icon") }, + { :class => "icon" } + ) else str << '' + image_tag("blank") + " " end @@ -111,5 +106,15 @@ module TodoHelper str << ",step:1,inputField:\"" + input_field + "\",cache:true,align:\"TR\" })\n" javascript_tag str end - + + private + + def image_tag_for_delete + image_tag("blank", :title =>"Delete action", :class=>"delete_item") + end + + def image_tag_for_edit(item) + image_tag("blank", :title =>"Edit action", :class=>"edit_item", :id=>"action-#{item.id}-edit-icon") + end + end diff --git a/tracks/app/views/context/_show_items.rhtml b/tracks/app/views/context/_show_items.rhtml index 01ab892f..c8154136 100644 --- a/tracks/app/views/context/_show_items.rhtml +++ b/tracks/app/views/context/_show_items.rhtml @@ -46,7 +46,7 @@ <%= end_form_tag %>