From 6677af6f8fe1b9fb7ca749b65601bc321dc562cc Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Wed, 18 Feb 2015 08:24:08 -0600 Subject: [PATCH] Use Rails helpers for the delete menu item Instead of creating id and routes manually, use the helpers that Rails provides in order to do this for us. --- app/helpers/todos_helper.rb | 2 +- test/helpers/todo_helpers_test.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index d1cdfa60..8431f6bf 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -166,7 +166,7 @@ module TodosHelper t('todos.delete'), {:controller => 'todos', :action => 'destroy', :id => todo.id}, :class => "icon_delete_item", - :id => "delete_#{dom_id(todo)}", + :id => dom_id(todo, "delete"), :x_confirm_message => t('todos.confirm_delete', :description => todo.description), :title => t('todos.delete_action')); end diff --git a/test/helpers/todo_helpers_test.rb b/test/helpers/todo_helpers_test.rb index 4d0940a7..5db3203d 100644 --- a/test/helpers/todo_helpers_test.rb +++ b/test/helpers/todo_helpers_test.rb @@ -7,4 +7,9 @@ class TodosHelpersTest < ActionView::TestCase html = remote_edit_button(todos(:call_bill)) assert_equal "\"Edit\"", html end + + test "remote_delete_menu" do + html = remote_delete_menu_item(todos(:call_bill)) + assert_equal "Delete", html + end end