changeset 180:dd5a154c17c7

Extracted txt result template to helper.
author Edho Arief <edho@myconan.net>
date Fri, 01 Feb 2013 22:57:49 +0700
parents b1aa7865bc7f
children 500c09718fd7
files app/helpers/pastes_helper.rb app/views/pastes/create.txt.erb
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/app/helpers/pastes_helper.rb	Fri Feb 01 22:37:06 2013 +0700
+++ b/app/helpers/pastes_helper.rb	Fri Feb 01 22:57:49 2013 +0700
@@ -1,2 +1,10 @@
 module PastesHelper
+  def print_txt_create_result
+    unless @paste.errors.any?
+      url =  paste_path @paste, :only_path => false
+      "#{url} (key: #{@paste.key})"
+    else
+      'Failed'
+    end
+  end
 end
--- a/app/views/pastes/create.txt.erb	Fri Feb 01 22:37:06 2013 +0700
+++ b/app/views/pastes/create.txt.erb	Fri Feb 01 22:57:49 2013 +0700
@@ -1,5 +1,1 @@
-<% unless @paste.errors.any? %>
-<%= paste_path @paste, :only_path => false %> (key: <%= @paste.key %>)
-<% else %>
-Failed
-<% end %>
+<%= print_txt_create_result %>