changeset 7:3a1f6c2e195d

Added raw paste view.
author Edho Arief <edho@myconan.net>
date Sun, 26 Aug 2012 11:39:07 -0700
parents 5e54b5ff78d0
children 418105d973f1
files app/controllers/pastes_controller.rb app/views/pastes/show.html.erb config/initializers/mime_types.rb
diffstat 3 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/app/controllers/pastes_controller.rb	Sun Aug 26 11:37:49 2012 -0700
+++ b/app/controllers/pastes_controller.rb	Sun Aug 26 11:39:07 2012 -0700
@@ -6,6 +6,7 @@
 
     respond_to do |format|
       format.html # show.html.erb
+      format.txt # show.html.erb
       format.json { render :json => @paste }
     end
   end
--- a/app/views/pastes/show.html.erb	Sun Aug 26 11:37:49 2012 -0700
+++ b/app/views/pastes/show.html.erb	Sun Aug 26 11:39:07 2012 -0700
@@ -9,3 +9,5 @@
   <b>Hash:</b>
   <%= @paste.paste_hash %>
 </p>
+
+<%= link_to 'Raw', paste_path(@paste, :txt) %>
--- a/config/initializers/mime_types.rb	Sun Aug 26 11:37:49 2012 -0700
+++ b/config/initializers/mime_types.rb	Sun Aug 26 11:39:07 2012 -0700
@@ -3,3 +3,4 @@
 # Add new mime types for use in respond_to blocks:
 # Mime::Type.register "text/richtext", :rtf
 # Mime::Type.register_alias "text/html", :iphone
+Mime::Type.register "text/plain", :txt