Permalink
Browse files

added raw mode

  • Loading branch information...
1 parent 1e844a7 commit b27cab3bb094ce21442af3d3598920b3dd6343fc @kazeburo committed Mar 29, 2011
Showing with 14 additions and 1 deletion.
  1. +14 −1 lib/NoNoPaste.pm
View
@@ -108,6 +108,14 @@ get '/entry/{id:[0-9a-f]{16}}' => sub {
$c->render('entry', entry => $entry );
};
+get '/entry/{id:[0-9a-f]{16}}/raw' => sub {
+ my ($self, $c) = @_;
+ my $entry = $self->retrieve_entry($c->args->{id});
+ return $c->res->not_found() unless $entry;
+ $c->res->content_type('text/plain; charset=UTF-8');
+ $c->render('raw_entry', entry => $entry );
+};
+
1;
__DATA__
@@ -209,7 +217,12 @@ $(function() {
<pre class="prettyprint">
<: $entry.body :>
</pre>
-<div class="entry_meta"><a href="<: $c.req.uri_for('/entry/' ~ $entry.id) :>" class="date"><: $entry.ctime :></a> / <span class="nick"><: $entry.nick :></span></div>
+<div class="entry_meta"><a href="<: $c.req.uri_for('/entry/' ~ $entry.id ~ '/raw') :>/">raw</a> / <a href="<: $c.req.uri_for('/entry/' ~ $entry.id) :>" class="date"><: $entry.ctime :></a> / <span class="nick"><: $entry.nick :></span></div>
</div>
: } # content
+@@ raw_entry
+<:= $entry.body :>
+
+
+

0 comments on commit b27cab3

Please sign in to comment.