Sha256: 95d0fa2bb164cf47cc589c096ff27a3de185095c29ef4c7725767197f965ac02

Contents?: true

Size: 822 Bytes

Versions: 25

Compression:

Stored size: 822 Bytes

Contents

(function() {
  var rootCommentableId = <%== "comments-for-#{commentable.commentable_type.demodulize}-#{commentable.id}".to_json %>;

  var $comments = $("#" + rootCommentableId);
  var component = $comments.data("comments");

<% @comments.each do |comment| %>
  var commentId = <%= comment.id.to_json %>;
  var commentHtml = '<%== j(render comment).strip %>';
  var inReplyTo = <%== (reply?(comment) ? comment.commentable.id : nil).to_json %>;

  var $comment = $("#comment_" + commentId);
  if (1 > $comment.length) {
    if (inReplyTo) {
      component.addReply(inReplyTo, commentHtml);
    } else {
      component.addThread(commentHtml);
    }
  }
<% end %>

  // Update the comments count
  $(".comments-count", $comments).text(<%== t("decidim.components.comments.title", count: @comments_count).to_json %>);
}());

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
decidim-comments-0.24.2 app/views/decidim/comments/comments/index.js.erb
decidim-comments-0.24.1 app/views/decidim/comments/comments/index.js.erb
decidim-comments-0.24.0 app/views/decidim/comments/comments/index.js.erb
decidim-comments-0.24.0.rc2 app/views/decidim/comments/comments/index.js.erb
decidim-comments-0.24.0.rc1 app/views/decidim/comments/comments/index.js.erb