app/helpers/decidim/comments/comments_helper.rb in decidim-comments-0.0.2 vs app/helpers/decidim/comments/comments_helper.rb in decidim-comments-0.0.3

- old
+ new

@@ -26,25 +26,20 @@ # # node_id - The id of the DOMElement to render the React component # props - A hash corresponding to Comments component props def react_comments_component(node_id, props) content_tag("div", "", id: node_id) + + javascript_include_tag("decidim/comments/comments") + javascript_tag(%{ - jQuery.ajax({ - url: '#{asset_path("decidim/comments/comments.js")}', - dataType: 'script', - cache: true - }).then(function () { - window.DecidimComments.renderCommentsComponent( - '#{node_id}', - { - commentableType: "#{props[:commentableType]}", - commentableId: "#{props[:commentableId]}", - options: JSON.parse("#{j(props[:options].to_json)}"), - locale: "#{props[:locale]}" - } - ); - }); + window.DecidimComments.renderCommentsComponent( + '#{node_id}', + { + commentableType: "#{props[:commentableType]}", + commentableId: "#{props[:commentableId]}", + options: JSON.parse("#{j(props[:options].to_json)}"), + locale: "#{props[:locale]}" + } + ); }) end end end end