From 753d4e212f7b896b8562d7eea03e43e04eb9a221 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Wed, 13 Aug 2014 15:02:48 +0530 Subject: [PATCH] commentslayout fix --- app/views/beispiele/_beispiel.html.erb | 8 +++++--- app/views/comments/_comment.html.erb | 11 ++++++++--- app/views/comments/_comments.html.erb | 4 +++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/views/beispiele/_beispiel.html.erb b/app/views/beispiele/_beispiel.html.erb index 15e3de1..d7b9290 100644 --- a/app/views/beispiele/_beispiel.html.erb +++ b/app/views/beispiele/_beispiel.html.erb @@ -2,7 +2,7 @@
-<%=link_to ffi1_icon("note20")+" " + beispiel.name, beispiel.beispieldatei.url, title: beispiel.desc %> + <%=link_to ffi1_icon("note20")+" " + beispiel.name, beispiel.beispieldatei.url, title: beispiel.desc %> <%= I18n.t("file.size") + ": " + (beispiel.beispieldatei.size/1024.0).round(2).to_s %>KiB
<%= @@ -31,9 +31,11 @@ end <%= beispiel.desc %>
-
<%= render partial:"comments/comments", object: beispiel.comments.roots %>
-<%= link_to "comment" , new_comment_path( commentable_type: "Beispiel", commentable_id: beispiel.id), remote:true %> +<%= link_to "comment" , new_comment_path( commentable_type: "Beispiel", commentable_id: beispiel.id), remote:true if can? :comment, beispiel %>
+<% unless beispiel.comments.roots.empty? %> +
<%= render partial:"comments/comments", object: beispiel.comments.order(:created_at).roots.reverse_order %>
+<% end %> diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 90e35c8..810365e 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,9 +1,14 @@
<%= image_tag comment.thumb_url %>
- <%= comment.user.try(:email) %> (<%= I18n.l(comment.created_at) %>): <%= comment.text %> -<%= link_to "comment" , new_comment_path( commentable_type: "Comment", commentable_id: comment.id), remote:true %> - <%= render partial:"comments/comments", object: comment.children if comment.children.size >0 %> + <%= comment.user.try(:email) %> (<%= I18n.l(comment.created_at) %>): +

<%= comment.text %> +<% if can?(:comment, comment.commentable) %> +
<%= link_to "comment" , new_comment_path( commentable_type: "Comment", commentable_id: comment.id), remote:true %> +<% end %> +

+ <%= render partial:"comments/comments", object: comment.children.order(:created_at).reverse_order if comment.children.size >0 %> +
diff --git a/app/views/comments/_comments.html.erb b/app/views/comments/_comments.html.erb index 4404446..1d2f091 100644 --- a/app/views/comments/_comments.html.erb +++ b/app/views/comments/_comments.html.erb @@ -1,7 +1,9 @@ -
+<% unless comments.empty? %> +
    <% comments.each do |c| %>
  • <%= render c %>
  • <% end %>
+<% end %>