Browse Source

+ /comments/:action

master
Alex 'AdUser' Z 9 years ago
parent
commit
269da0952f
  1. 11
      lib/LDV.pm
  2. 29
      public/theme/css/default.css
  3. 16
      templates/comments/list.html.ep
  4. 2
      templates/comments/none.html.ep

11
lib/LDV.pm

@ -37,7 +37,15 @@ sub startup {
my $r = $self->routes; my $r = $self->routes;
# /user { # /comments
my $comm = $r->route('/comments') -> to(controller => 'comments');
$comm->post('/add') ->to(action => 'add');
$comm->get ('/get') ->to(action => 'get');
mkdir $self->app->home->rel_dir('data/comments');
}
{ # /user
my $user = $r->route('/user') -> to(controller => 'user'); my $user = $r->route('/user') -> to(controller => 'user');
$user->get('/') ->to(cb => sub { shift->redirect_to('/user/login'); }); $user->get('/') ->to(cb => sub { shift->redirect_to('/user/login'); });
$user->get('/login') ->to(action => 'login'); $user->get('/login') ->to(action => 'login');
@ -48,6 +56,7 @@ sub startup {
$user->get ('/logout') ->to(action => 'logout'); $user->get ('/logout') ->to(action => 'logout');
$user->post('/create') ->to(action => 'create'); $user->post('/create') ->to(action => 'create');
$user->post('/update') ->to(action => 'update'); $user->post('/update') ->to(action => 'update');
}
{ # /zerobin { # /zerobin
my $zb = $r->route('/zerobin2') -> to(controller => 'zerobin'); my $zb = $r->route('/zerobin2') -> to(controller => 'zerobin');

29
public/theme/css/default.css

@ -48,13 +48,14 @@ div.article {
margin-bottom: 20px; margin-bottom: 20px;
} }
div.article span.tags { float: right; } span.tags { float: right; }
div.article span.tags a { background: url('/theme/img/tag.png') no-repeat center left; padding-left: 18px; } span.tags a { background: url('/theme/img/tag.png') no-repeat center left; padding-left: 18px; }
div.article span.date { background: url('/theme/img/time.png') no-repeat center left; padding-left: 18px; } span.date { background: url('/theme/img/time.png') no-repeat center left; padding-left: 18px; }
div.article span.user { background: url('/theme/img/user.png') no-repeat center left; padding-left: 18px; } span.user { background: url('/theme/img/user.png') no-repeat center left; padding-left: 18px; }
div.article div.bottom_bar { div.article div.bottom_bar {
border-top: 1px dashed #A0B0C0; border-top: 1px dashed #A0B0C0;
min-height: 16px;
} }
div.feeds a { div.feeds a {
@ -81,6 +82,26 @@ h1 {
h2 { font-size: 130%; } h2 { font-size: 130%; }
/* comments */
div.comment {
margin-bottom: 10px;
}
div.comment div.cinfo {
border-bottom: 1px dashed #506070;
margin-bottom: 5px;
}
form#cadd textarea {
min-width: 400px;
min-height: 100px;
}
form#cadd input[type=submit] {
background: url('/theme/img/save.png') no-repeat center left;
padding-left: 18px;
}
/* common page parts */ /* common page parts */
.ui-block { .ui-block {
background-color: #FFFFFF; background-color: #FFFFFF;

16
templates/comments/list.html.ep

@ -0,0 +1,16 @@
% my $comments = stash('comments') || [];
% my $num = 1;
<h3>Комментарии:</h3>
% foreach my $comment (@{ $comments }) {
<div class="comment">
<div class="cinfo">
<span class="num">#&nbsp;<%= $num++ %></span>&nbsp;
<span class="user"><%= $comment->{user} %></span>&nbsp;
<span class="date"><%= from_unixtime $comment->{time} %></span>&nbsp;
</div>
<div class="ctext">
%== markdown $comment->{text}
</div>
</div>
% }
<p><a href="#" id="cadd"><%= l('Add') %></a></p>

2
templates/comments/none.html.ep

@ -0,0 +1,2 @@
<%= l('No comments yet') %>.&nbsp;
<a href="#" id="cadd"><%= l('Add') %>?</a>
Loading…
Cancel
Save