From ad77b46d26d406d48fbe00664e51589d3e944f44 Mon Sep 17 00:00:00 2001 From: "Vyacheslav N. Boyko" Date: Mon, 11 Dec 2017 17:48:01 +0300 Subject: [PATCH] working on commenting ability --- src/main/resources/resources/css/mystyle.css | 22 ++++++++++++++ .../fragments/commentCreationForm.jade | 3 +- .../comments/fragments/pagination.jade | 26 ++++++++++++++++ .../resources/templates/comments/list.jade | 30 ++++--------------- .../resources/templates/comments/one.jade | 13 +++----- 5 files changed, 59 insertions(+), 35 deletions(-) create mode 100644 src/main/resources/templates/comments/fragments/pagination.jade diff --git a/src/main/resources/resources/css/mystyle.css b/src/main/resources/resources/css/mystyle.css index 6da8d38..eecb672 100644 --- a/src/main/resources/resources/css/mystyle.css +++ b/src/main/resources/resources/css/mystyle.css @@ -174,4 +174,26 @@ img.borderless { float: left; color: red; padding-right: 10px; +} + +h1 { + font-size: 30px !important; +} +h2 { + font-size: 24px !important; +} +h3 { + font-size: 18px !important; +} +h4 { + font-size: 16px !important; +} +h5 { + font-size: 14px !important; +} +h6 { + font-size: 12px !important; +} +body { + font: 300 14px "Helvetica Neue",Helvetica, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans; } \ No newline at end of file diff --git a/src/main/resources/templates/comments/fragments/commentCreationForm.jade b/src/main/resources/templates/comments/fragments/commentCreationForm.jade index f9984cb..637a983 100644 --- a/src/main/resources/templates/comments/fragments/commentCreationForm.jade +++ b/src/main/resources/templates/comments/fragments/commentCreationForm.jade @@ -1,6 +1,7 @@ +hr -form#commentForm.comment-form(action="comments", method="POST") +form#commentForm.comment-form(action="/posts/"+post.getId()+"/comments", method="POST") .item-row input(type="hidden", name='_csrf', value='#{_csrf.token}') .item-row diff --git a/src/main/resources/templates/comments/fragments/pagination.jade b/src/main/resources/templates/comments/fragments/pagination.jade new file mode 100644 index 0000000..24242cb --- /dev/null +++ b/src/main/resources/templates/comments/fragments/pagination.jade @@ -0,0 +1,26 @@ + +.load-more + nav + ul.pagination + if page > 1 + li.previous + a.btn(href="?page=#{page - 1}") + span(aria-hidden="true") ← + | Older comments + + for pageNum in pagesList + if pageNum==page + li.active + a.btn(href="?page=#{pageNum}") + = pageNum + else + li + a.btn(href="?page=#{pageNum}") + = pageNum + + + if totalPages > page + li.next + a.btn(href="?page=#{page + 1}") + | Newer comments + span(aria-hidden="true") → diff --git a/src/main/resources/templates/comments/list.jade b/src/main/resources/templates/comments/list.jade index ddd4391..5341bf4 100644 --- a/src/main/resources/templates/comments/list.jade +++ b/src/main/resources/templates/comments/list.jade @@ -1,29 +1,5 @@ -.load-more - nav - ul.pagination - if page > 1 - li.previous - a.btn(href="?page=#{page - 1}") - span(aria-hidden="true") ← - | Older comments - - for pageNum in pagesList - if pageNum==page - li.active - a.btn(href="?page=#{pageNum}") - = pageNum - else - li - a.btn(href="?page=#{pageNum}") - = pageNum - - - if totalPages > page - li.next - a.btn(href="?page=#{page + 1}") - | Newer comments - span(aria-hidden="true") → +include fragments/pagination for comment in comments if comment.getDeletedMark() @@ -31,6 +7,10 @@ for comment in comments else include one +include fragments/pagination + if userService.currentUserCanWrite() include fragments/commentCreationForm + + diff --git a/src/main/resources/templates/comments/one.jade b/src/main/resources/templates/comments/one.jade index bbf33ae..65fb6a9 100644 --- a/src/main/resources/templates/comments/one.jade +++ b/src/main/resources/templates/comments/one.jade @@ -1,22 +1,17 @@ .panel.panel-default .panel-heading - span #{comment.getUser().getNickname()}, #{viewHelper.getFormattedDate(comment.getCreatedAt())} + span + b #{comment.getUser().getNickname()} + |, #{viewHelper.getFormattedDate(comment.getCreatedAt())} div if userService.isCurrentUserAdmin() .td - admin + | admin .panel-body !{comment.getRenderedContent()} - //if userService.currentUserCanWrite() - // div - // = userService.currentUser().getNickname() - // include fragments/commentCreationForm - //if commentService.childrenCount(comments, comment) > 0 - // .comment-children(style="padding-left: #{5 * commentService.childrenCount(comments, comment)}px") - // include list