Sha256: 5fb793510092282efccadf4944e7ad9e2f1de404e40ff10526b471608613e9c2

Contents?: true

Size: 836 Bytes

Versions: 13

Compression:

Stored size: 836 Bytes

Contents

$(() => {
  var rootCommentableId = <%== "comments-for-#{@commentable.class.name.demodulize}-#{@commentable.id}".to_json %>;
  var $comments = $("#" + rootCommentableId);
  var config = $comments.data("decidim-comments");

  component = new Decidim.CommentsComponent($comments, config);
  component.unmountComponent();

  var commentHtml = '<%== j(render partial: "edited_comment", locals: { comment: @comment }).strip %>';
  var commentId = <%= @comment.id.to_json %>;
  var $comment = $("#comment_<%= @comment.id %>");

  $comment.replaceWith(commentHtml);

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

  Rails.fire(document, "comments:loaded", {
    commentsIds: [commentId]
  });
});

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-comments-0.29.1 app/views/decidim/comments/comments/update.js.erb
decidim-comments-0.28.4 app/views/decidim/comments/comments/update.js.erb
decidim-comments-0.29.0 app/views/decidim/comments/comments/update.js.erb
decidim-comments-0.28.3 app/views/decidim/comments/comments/update.js.erb
decidim-comments-0.29.0.rc4 app/views/decidim/comments/comments/update.js.erb
decidim-comments-0.29.0.rc3 app/views/decidim/comments/comments/update.js.erb
decidim-comments-0.29.0.rc2 app/views/decidim/comments/comments/update.js.erb
decidim-comments-0.29.0.rc1 app/views/decidim/comments/comments/update.js.erb
decidim-comments-0.28.2 app/views/decidim/comments/comments/update.js.erb
decidim-comments-0.28.1 app/views/decidim/comments/comments/update.js.erb
decidim-comments-0.28.0 app/views/decidim/comments/comments/update.js.erb
decidim-comments-0.28.0.rc5 app/views/decidim/comments/comments/update.js.erb
decidim-comments-0.28.0.rc4 app/views/decidim/comments/comments/update.js.erb