return $c->reply->not_found
if !defined $stat;
+ if (defined $c->param('download')) {
+ $c->res->headers->content_disposition(
+ "attachment; filename=$fullname"
+ );
+ $c->reply->file($file);
+ return;
+ }
$c->stash(mtime => POSIX::strftime('%Y-%m-%d %H:%M:%S',
localtime($stat->mtime)));
my $content = $file->slurp;
<h1><tt><%= $filename%>.<%= $ext %></tt>
<span class="unimportant">— <%= config->{appname} %></span><br/>
-<small class="unimportant">Created: <%= $mtime %></small></h1>
+<small class="unimportant">Created: <%= $mtime %>
+<%= link_to "Download" => url_for->query(download => 1), class => 'downl' %>
+</small></h1>
<pre><code class="<%= $language %>"><%= $file_content %></code></pre>
a {
color: #90c0ff;
}
+ a.downl {
+ display: inline-block;
+ float: right;
+ }
</style>
<title><%= config->{appname} %></title>
</head>