diff --git a/app/views/comments/_comments_block.html.erb b/app/views/comments/_comments_block.html.erb index 4fa2086..7bee5ba 100644 --- a/app/views/comments/_comments_block.html.erb +++ b/app/views/comments/_comments_block.html.erb @@ -1,13 +1,15 @@ <%= link_to "Comments:.."+ comments_block.comments.count().to_s, comments_path(commentable_type: comments_block.class.to_s.gsub("::","_"), commentable_id: comments_block.id), remote:true, id: Comment.switchshowid_for( comments_block) %> <%# load the comments in the comments block %> -

-<%= link_to "Comment" , new_comment_path( commentable_type: comments_block.class.to_s.gsub("::","_"), commentable_id: comments_block.id), remote:true if can? :comment, comments_block %> <%# This is the button to add a new comment %> + +<%= link_to content_tag(:span, content_tag(:i,"",class:"fa fa-comment-o fa-stack-2x")+ content_tag(:i,"",class:"fa fa-plus-square-o fa-stack-1x"),class:"fa-stack")+ "Comment" , new_comment_path( commentable_type: comments_block.class.to_s.gsub("::","_"), commentable_id: comments_block.id), remote:true if can? :comment, comments_block %> <%# This is the button to add a new comment %>

">
-

+ +
<% unless comments_block.comments.roots.empty? %> -
+ <%= render partial:"comments/comments", object: comments_block.comments.order(:created_at).roots.reverse_order if params[:show_comments] %><%# can? fehlt!%> -
+ <% end %> +
diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb index 9dce0fd..d11ba1f 100644 --- a/app/views/comments/create.js.erb +++ b/app/views/comments/create.js.erb @@ -1,2 +1,3 @@ $("#<%= divid_for(@comment.parent_object,"newform") %>").html("") $("#<%= Comment.wrapid_for(@comment.parent_object) %>").html("<%= escape_javascript render partial:"comments/comments", object: @comments %>") + $("#<%= Comment.switchshowid_for(@commentable) %>").replaceWith("<%= escape_javascript link_to "Ausblenden", hide_comments_path(params: {commentable_type: @commentable.class.to_s.gsub("::","_"), commentable_id: @commentable.id}), remote: true , id: Comment.switchshowid_for( @commentable) %>") diff --git a/app/views/survey/questions/show.html.erb b/app/views/survey/questions/show.html.erb index 04e0f1e..2d75431 100644 --- a/app/views/survey/questions/show.html.erb +++ b/app/views/survey/questions/show.html.erb @@ -3,7 +3,7 @@ Typ: <%= @survey_question.typ %>

-<%= render @survey_question.parent unless @survey_question.parent.nil?|| !(@survey_question.parent.class == Neuigkeit) %> +<%= render partial: "/"+@survey_question.parent.to_partial_path, object: @survey_question.parent unless @survey_question.parent.nil? %> <%= render @survey_question %> <%= render_comments_for(@survey_question) %>