Sha256: e35cee2aa575924ae5b8f7eec87ff7aca1401fcb9c74968153b8a3b1c5fb9cac

Contents?: true

Size: 1022 Bytes

Versions: 11

Compression:

Stored size: 1022 Bytes

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) %>');
    hideButton.removeClass("hide");
  } else {
    component.addThread(commentHtml, true);
  }

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

  Decidim.addInputEmoji();
}());

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-comments-0.27.9 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.27.8 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.27.7 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.27.6 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.26.10 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.26.9 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.27.5 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.26.8 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.27.4 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.27.3 app/views/decidim/comments/comments/create.js.erb
decidim-comments-0.26.7 app/views/decidim/comments/comments/create.js.erb