From 4399804e1915774fbfd3e01d243ac67a5facb294 Mon Sep 17 00:00:00 2001 From: chris2tof Date: Fri, 13 May 2011 09:59:29 +0800 Subject: [PATCH] Delete link handle JavaScript disabled --- app/controllers/admin/links_controller.rb | 11 +++++++---- app/views/admin/links/delete.html.erb | 7 +++++++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 app/views/admin/links/delete.html.erb diff --git a/app/controllers/admin/links_controller.rb b/app/controllers/admin/links_controller.rb index b1ba5db6..e3761bed 100644 --- a/app/controllers/admin/links_controller.rb +++ b/app/controllers/admin/links_controller.rb @@ -61,10 +61,6 @@ class Admin::LinksController < ApplicationController @link = Link.find(params[:id]) @link.destroy @link.destroy_i18n_variable - end - - def delete - destroy respond_to do |format| format.html { redirect_to admin_items_url @@ -73,4 +69,11 @@ class Admin::LinksController < ApplicationController end end + def delete + respond_to do |format| + format.html {} + format.js { destroy } + end + end + end diff --git a/app/views/admin/links/delete.html.erb b/app/views/admin/links/delete.html.erb new file mode 100644 index 00000000..b6893dae --- /dev/null +++ b/app/views/admin/links/delete.html.erb @@ -0,0 +1,7 @@ +<% form_for :link, :url => admin_link_path(@link), :html => { :method => :delete } do |f| %> +

<%= t('sure?') %>

+

+ <%= submit_tag t(:delete) %> + <%= link_back %> +

+<% end %> \ No newline at end of file