Sha256: b9bb3ebfd097e6893c1945564ca8489d486255feeeebdf8284057e0059173c07

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

Contents

(function() {
  var rootCommentableId = <%== "comments-for-#{@comment.root_commentable.commentable_type.demodulize}-#{@comment.root_commentable.id}".to_json %>;
  var commentHtml = '<%== j(render @comment).strip %>';
  var inReplyTo = <%== (reply?(@comment) ? @commentable.id : nil).to_json %>;

  var $comments = $("#" + rootCommentableId);
  var component = $comments.data("comments");
  if (inReplyTo) {
    component.addReply(inReplyTo, commentHtml, true);

    var hideButton = $("#comment_" + <%= root_comment.id %>).find(".comment__hide").first();
    hideButton.find(".show-comment-replies").first().html('<%= t("decidim.components.comment.show_replies", count: Decidim::Comments::SortedComments.for(root_comment.reload).size) %>');

  } else {
    component.addThread(commentHtml, true);
  }

  Rails.fire(document, "comments:loaded", {
    commentsIds: [<%= @comment.id %>, <%= @comment.commentable.id %>]
  });

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-comments-0.28.5 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.28.4 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.28.3 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.28.2 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.28.1 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.28.0 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.28.0.rc5 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.28.0.rc4 app/views/decidim/comments/comments/create.js.erb