Browse Source

* /zerobin2 -> /zerobin

master
Alex 'AdUser' Z 7 years ago
parent
commit
6711871165
  1. 2
      lib/LDV.pm
  2. 8
      lib/LDV/Zerobin.pm
  3. 2
      templates/zerobin/create.html.ep
  4. 4
      templates/zerobin/view.html.ep

2
lib/LDV.pm

@ -51,7 +51,7 @@ sub startup {
}
{ # /zerobin
my $zb = $r->route('/zerobin2') -> to(controller => 'zerobin');
my $zb = $r->route('/zerobin') -> to(controller => 'zerobin');
$zb->post('/') -> to(action => 'save');
$zb->get ('/') -> to(action => 'create');
$zb->route('/:time', time => qr/\d+/)

8
lib/LDV/Zerobin.pm

@ -101,7 +101,7 @@ sub view {
$self->app->log->error($@);
$@ = "internal error" if ($@ =~ m|at \S+ line \d+|oi);
$self->flash({'result' => $@});
$self->redirect_to("/zerobin2");
$self->redirect_to("/zerobin");
return;
};
@ -148,13 +148,13 @@ sub save {
syntax => $syntax,
});
$self->_content_save($time, $paste);
$self->redirect_to("/zerobin2/$time"); 1;
$self->redirect_to("/zerobin/$time"); 1;
} or do {
chomp $@;
$self->app->log->error($@);
$@ = "internal error" if ($@ =~ m|at \S+ line \d+|oi);
$self->flash({'result' => $@});
$self->redirect_to("/zerobin2");
$self->redirect_to("/zerobin");
};
$self->rendered;
@ -183,7 +183,7 @@ sub prune {
$self->stash({result => $@});
};
$self->redirect_to("/zerobin2");
$self->redirect_to("/zerobin");
$self->rendered;
}

2
templates/zerobin/create.html.ep

@ -8,7 +8,7 @@
% my %opts = (id => 'paste', name => 'paste');
<h1>Создать запись</h1>
<div>
<%= form_for "/zerobin2" => (method => 'POST', enctype => "multipart/form-data") => begin %>
<%= form_for "/zerobin" => (method => 'POST', enctype => "multipart/form-data") => begin %>
<div>
<span class="zerobin">
<%= submit_button l('Save') %>&nbsp;

4
templates/zerobin/view.html.ep

@ -1,10 +1,10 @@
% layout 'default';
% title 'Zerobin -- View';
% my $paste = (stash 'paste') || {};
% my $paste = stash('paste') || {};
<h1><%= l('View paste') %></h1>
<div>
<div>
<%= link_to l('Create new') => "/zerobin2", class => 'zerobin create' %>
<%= link_to l('Create new') => "/zerobin", class => 'zerobin create' %>
<%= link_to l('Download') => "/zerobin/$paste->{time}.txt", class => 'zerobin download' %>
</div>
<br/>

Loading…
Cancel
Save