diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb index 67c347ced..0f8eca926 100644 --- a/app/helpers/comments_helper.rb +++ b/app/helpers/comments_helper.rb @@ -17,4 +17,23 @@ module CommentsHelper comments.select{|c| c.parent_id == parent.id} end + def user_level_class(comment) + if comment.as_administrator? + "is-admin" + elsif comment.as_moderator? + "is-moderator" + elsif comment.user.official? + "level-#{comment.user.official_level}" + else + "" # Default no special user class + end + end + + def comment_author_class(comment, author_id) + if comment.user_id == author_id + "is-author" + else + "" # Default not author class + end + end end diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index e2ce326aa..c353fb499 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -62,19 +62,12 @@  •  - <% if comment.as_administrator? %> -
<%= simple_format text_with_links comment.body %>
- <% elsif comment.as_moderator? %> -
<%= simple_format text_with_links comment.body %>
- <% elsif comment.user.official? && comment.user_id == @commentable.author_id %> -
<%= simple_format text_with_links comment.body %>
- <% elsif comment.user.official? %> -
<%= simple_format text_with_links comment.body %>
- <% elsif comment.user_id == @commentable.author_id %> -
<%= simple_format text_with_links comment.body %>
- <% else %> -
<%= simple_format text_with_links comment.body %>
- <% end %> +
+ <%= text_with_links comment.body %> +
+ <%= render 'comments/votes', comment: comment %>