diff options
author | Javan Makhmali <javan@javan.us> | 2018-10-03 14:41:47 -0400 |
---|---|---|
committer | Javan Makhmali <javan@javan.us> | 2018-10-03 14:41:47 -0400 |
commit | 30443121286c3bb970d4d24bf7f24472498e9633 (patch) | |
tree | 6799fe7cc8aaabd6bfa35c8dfc75a11eb7f4e332 /lib/action_text/content.rb | |
parent | 7a993324342d5542dcb40902eed097f7eaac3f1b (diff) | |
download | rails-30443121286c3bb970d4d24bf7f24472498e9633.tar.gz rails-30443121286c3bb970d4d24bf7f24472498e9633.tar.bz2 rails-30443121286c3bb970d4d24bf7f24472498e9633.zip |
Move attachment rendering to a helper
Fixes #5
Diffstat (limited to 'lib/action_text/content.rb')
-rw-r--r-- | lib/action_text/content.rb | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/lib/action_text/content.rb b/lib/action_text/content.rb index 71d9e98657..4061613e35 100644 --- a/lib/action_text/content.rb +++ b/lib/action_text/content.rb @@ -81,23 +81,8 @@ module ActionText fragment.to_html end - def to_rendered_html - render_attachments do |attachment| - attachment.node.tap do |node| - node.inner_html = ActionText.renderer.render(attachment) - end - end.render_attachment_galleries do |attachment_gallery| - ActionText.renderer.render(layout: attachment_gallery, object: attachment_gallery, formats: "html") do - attachment_gallery.attachments.map do |attachment| - attachment.node.inner_html = ActionText.renderer.render(attachment) - attachment.to_html - end.join("").html_safe - end - end.to_html - end - def to_rendered_html_with_layout - ActionText.renderer.render(partial: "action_text/content/layout", locals: { document: to_rendered_html }) + ActionText.renderer.render(partial: "action_text/content/layout", locals: { content: self }) end def to_s |