From d86174d147943a57eb1aba4d0578b97af49584b3 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Mon, 19 Nov 2012 22:27:52 +0100 Subject: [PATCH] link_to_delete_asciicast helper --- app/helpers/asciicasts_helper.rb | 6 ++++++ app/views/asciicasts/show.html.erb | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/helpers/asciicasts_helper.rb b/app/helpers/asciicasts_helper.rb index 0fd5d6d..706f69b 100644 --- a/app/helpers/asciicasts_helper.rb +++ b/app/helpers/asciicasts_helper.rb @@ -27,4 +27,10 @@ module AsciicastsHelper snapshot: asciicast.snapshot } end + + def link_to_delete_asciicast(name, asciicast) + link_to name, asciicast_path(asciicast), + :method => :delete, :confirm => 'Really delete this asciicast?' + end + end diff --git a/app/views/asciicasts/show.html.erb b/app/views/asciicasts/show.html.erb index 731bc54..c5a1af0 100644 --- a/app/views/asciicasts/show.html.erb +++ b/app/views/asciicasts/show.html.erb @@ -30,8 +30,7 @@
  • - <%= link_to 'Delete', asciicast_path(@asciicast), - :method => :delete, :confirm => 'Really delete this asciicast?' %> + <%= link_to_delete_asciicast 'Delete', @asciicast %>
  • <% end %>