Alex 'AdUser' Z
7 years ago
3 changed files with 91 additions and 0 deletions
@ -0,0 +1,35 @@
|
||||
% layout 'default'; |
||||
% title 'Filebin -- Create'; |
||||
% my %times = (day => 1, week => 7, month => 30, quarter => 90, year => 365); |
||||
% my @times = map { [l($_) => $times{$_}] } sort { $times{$a} <=> $times{$b} } keys(%times); |
||||
% param expire => $times{ config->{filebin}->{expire} || 'year' }; |
||||
<h1>Загрузить файл</h1> |
||||
<div> |
||||
<%= form_for "/filebin" => (method => 'POST', enctype => 'multipart/form-data') => begin %> |
||||
<div> |
||||
<span class="filebin cblock"> |
||||
<%= submit_button l('Upload') %> |
||||
</span> |
||||
<span class="filebin cblock"> |
||||
<%= tag 'label' => (for => 'expire') => l('Keep for') %>: |
||||
<%= select_field 'expire' => \@times %> |
||||
</span> |
||||
% if (config->{filebin}->{show_latest}) { |
||||
<%= link_to l('Latest images') => "/filebin/latest", class => 'filebin latest' %> |
||||
% } |
||||
</div> |
||||
<hr/> |
||||
<div> |
||||
<%= file_field 'file', required => 1 %> |
||||
</div> |
||||
<% end %> |
||||
<br/> |
||||
% my $size = sprintf "%.1f Mb", config->{filebin}->{file_maxsize} / 1024 ** 2; |
||||
<table class="filebin limits"> |
||||
<tr><td><%= l('Max filesize') %></td><td> : </td><%= tag td => $size %></tr> |
||||
<tr><td><%= l('Max image') %></td><td> : </td><%= tag td => config->{filebin}->{image_maxres} %></tr> |
||||
</table> |
||||
</div> |
||||
% if (my $error = flash('error')) { |
||||
<%= tag span => (class => 'filebin error') => l(ucfirst($error)) %> |
||||
% } |
@ -0,0 +1,24 @@
|
||||
% layout 'default'; |
||||
% title 'Filebin -- Latest'; |
||||
<h1><%= l('Latest files') %></h1> |
||||
<div> |
||||
<div> |
||||
<%= link_to l('Upload') => "/filebin", class => 'filebin upload' %> |
||||
</div> |
||||
<hr/> |
||||
<table class="filebin files"> |
||||
<tr> |
||||
<th>T</th> |
||||
<th><%= l('Filename') %></th> |
||||
<th><%= l('Info') %></th> |
||||
</tr> |
||||
<tr> |
||||
% my $files = stash('files') || []; |
||||
% foreach my $file (@{ $files }) { |
||||
<td><%= $file->{ftype} %></td> |
||||
<td><%= link_to $file->{fname} => $file->{url} %></td> |
||||
<td><%= $file->{info} %></td> |
||||
</tr> |
||||
% } |
||||
</table> |
||||
</div> |
@ -0,0 +1,32 @@
|
||||
% layout 'default'; |
||||
% title 'Filebin -- View'; |
||||
% my $file = stash('file') || {}; |
||||
<h1><%= l('View file') %></h1> |
||||
<div> |
||||
<div> |
||||
<%= link_to l('Upload') => "/filebin", class => 'filebin upload' %> |
||||
<%= link_to l('Download') => $file->{path}, class => 'filebin download', download => $file->{fname} %> |
||||
% if (config->{filebin}->{show_latest}) { |
||||
<%= link_to l('Latest files') => "/filebin/latest", class => 'filebin latest' %> |
||||
% } |
||||
</div> |
||||
<hr/> |
||||
<div class="filebin file"> |
||||
% if ($file->{ftype} eq 'i') { |
||||
<%= image $file->{path} %> |
||||
% } elsif ($file->{ftype} eq 'a') { |
||||
<%= tag audio => (src => $file->{path}, controls => 'controls', loop => 0, autoplay => 0) => l('HTML5-aware browser required') %> |
||||
% } elsif ($file->{ftype} eq 'v') { |
||||
<%= tag video => (src => $file->{path}, controls => 'controls', loop => 0, autoplay => 0) => l('HTML5-aware browser required') %> |
||||
% } |
||||
</div> |
||||
<hr/> |
||||
<table> |
||||
<tr><td><%= l('Name') %></td><td>:</td><td><%= $file->{fname} %></td></tr> |
||||
<tr><td><%= l('Size') %></td><td>:</td><td><%= sprintf("%.1f kb", $file->{fsize} / 1024) %></td></tr> |
||||
<tr><td><%= l('Mime') %></td><td>:</td><td><%= $file->{fmime} %></td></tr> |
||||
% if ($file->{ftype} eq 'i' or $file->{ftype} eq 'v') { |
||||
<tr><td><%= l('Image size') %></td><td>:</td><td><%= sprintf("%dx%d", $file->{res_w}, $file->{res_h}) %></td></tr> |
||||
% } |
||||
</table> |
||||
</div> |
Loading…
Reference in new issue