Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

handle no-comments

  • Loading branch information...
commit 7e6ed30e70a1d2576e06ad0341ee17f278d119e1 1 parent 8cae876
@releu releu authored
View
4 app/assets/stylesheets/styles.less
@@ -507,6 +507,10 @@ a.secondary {
.comments-title {
}
+.comments-empty {
+ font-style: italic;
+}
+
.comment {
margin-bottom: 20px;
}
View
32 app/views/posts/_comments.html.slim
@@ -2,20 +2,24 @@ section class="comments"
header
h1 class="comments-title subtitle" Comments
- - @post.persisted_comments.each do |comment|
- article class="comment" data-author="#{comment.user.username}"
- div class="comment-author"
- = link_to comment.user, title: comment.user.username do
- = avatar_image comment.user, 84
- div class="comment-container"
- div class="comment-title"
- = link_to comment.user, comment.user.username
- | commented
- = time_ago_in_words comment.created_at
- | ago
- div class="comment-body markdown"
- == Markdown.markdown comment.content, flavored: true
- div class="clear"
+ - comments = @post.persisted_comments
+ - if comments.any?
+ - comments.each do |comment|
+ article class="comment" data-author="#{comment.user.username}"
+ div class="comment-author"
+ = link_to comment.user, title: comment.user.username do
+ = avatar_image comment.user, 84
+ div class="comment-container"
+ div class="comment-title"
+ = link_to comment.user, comment.user.username
+ | commented
+ = time_ago_in_words comment.created_at
+ | ago
+ div class="comment-body markdown"
+ == Markdown.markdown comment.content, flavored: true
+ div class="clear"
+ - else
+ p class="comments-empty" No comments yet.
- if user_signed_in?
h2 class="new-comment-title subtitle" New Comment
Please sign in to comment.
Something went wrong with that request. Please try again.