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 %>