Sha256: f1241c086991bed605f3eb390ef37df59825221d0fc5405f0439955ae2f79968

Contents?: true

Size: 786 Bytes

Versions: 6

Compression:

Stored size: 786 Bytes

Contents

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

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

  var commentsHtml = '<%== j(render partial: "comments").strip %>';
  $comments.replaceWith(commentsHtml);

  $comments = $("#" + rootCommentableId);
  $comments.foundation();

  // Re-create the component
  component = new Decidim.CommentsComponent($comments, $comments.data("decidim-comments"));
  component.mountComponent();
  $comments.data("comments", component);

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

Version data entries

6 entries across 6 versions & 1 rubygems

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