diff --git a/lib/LDV.pm b/lib/LDV.pm index 48bc392..109da05 100644 --- a/lib/LDV.pm +++ b/lib/LDV.pm @@ -37,7 +37,15 @@ sub startup { 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'); $user->get('/') ->to(cb => sub { shift->redirect_to('/user/login'); }); $user->get('/login') ->to(action => 'login'); @@ -48,6 +56,7 @@ sub startup { $user->get ('/logout') ->to(action => 'logout'); $user->post('/create') ->to(action => 'create'); $user->post('/update') ->to(action => 'update'); + } { # /zerobin my $zb = $r->route('/zerobin2') -> to(controller => 'zerobin'); diff --git a/public/theme/css/default.css b/public/theme/css/default.css index d5c4f83..2404d41 100644 --- a/public/theme/css/default.css +++ b/public/theme/css/default.css @@ -48,13 +48,14 @@ div.article { margin-bottom: 20px; } -div.article span.tags { float: right; } -div.article 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; } -div.article span.user { background: url('/theme/img/user.png') no-repeat center left; padding-left: 18px; } +span.tags { float: right; } +span.tags a { background: url('/theme/img/tag.png') no-repeat center left; padding-left: 18px; } +span.date { background: url('/theme/img/time.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 { border-top: 1px dashed #A0B0C0; + min-height: 16px; } div.feeds a { @@ -81,6 +82,26 @@ h1 { 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 */ .ui-block { background-color: #FFFFFF; diff --git a/templates/comments/list.html.ep b/templates/comments/list.html.ep new file mode 100644 index 0000000..eb18530 --- /dev/null +++ b/templates/comments/list.html.ep @@ -0,0 +1,16 @@ +% my $comments = stash('comments') || []; +% my $num = 1; +

Комментарии:

+% foreach my $comment (@{ $comments }) { +
+
+ # <%= $num++ %>  + <%= $comment->{user} %>  + <%= from_unixtime $comment->{time} %>  +
+
+%== markdown $comment->{text} +
+
+% } +

<%= l('Add') %>

diff --git a/templates/comments/none.html.ep b/templates/comments/none.html.ep new file mode 100644 index 0000000..3a92238 --- /dev/null +++ b/templates/comments/none.html.ep @@ -0,0 +1,2 @@ +<%= l('No comments yet') %>.  +<%= l('Add') %>?