Permalink
Browse files

handle no-comments

  • Loading branch information...
1 parent 8cae876 commit 7e6ed30e70a1d2576e06ad0341ee17f278d119e1 @releu releu committed Feb 28, 2013
Showing with 22 additions and 14 deletions.
  1. +4 −0 app/assets/stylesheets/styles.less
  2. +18 −14 app/views/posts/_comments.html.slim
@@ -507,6 +507,10 @@ a.secondary {
.comments-title {
}
+.comments-empty {
+ font-style: italic;
+}
+
.comment {
margin-bottom: 20px;
}
@@ -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

0 comments on commit 7e6ed30

Please sign in to comment.