diff options
author | Javan Makhmali <javan@javan.us> | 2018-02-13 15:07:29 -0500 |
---|---|---|
committer | Javan Makhmali <javan@javan.us> | 2018-02-13 15:07:29 -0500 |
commit | 2ae84d647feac338082175f581bd1ca0c33d003a (patch) | |
tree | f7e2f058fcf6689e27b2862877b49bef54f5e449 | |
parent | b79bf62196f1032d4a6f95799ced79cbbadad856 (diff) | |
download | rails-2ae84d647feac338082175f581bd1ca0c33d003a.tar.gz rails-2ae84d647feac338082175f581bd1ca0c33d003a.tar.bz2 rails-2ae84d647feac338082175f581bd1ca0c33d003a.zip |
Initial Attachment rendering support
-rw-r--r-- | app/views/active_storage/blobs/_blob.html.erb | 7 | ||||
-rw-r--r-- | lib/active_text/attachment.rb | 6 | ||||
-rw-r--r-- | lib/active_text/content.rb | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/app/views/active_storage/blobs/_blob.html.erb b/app/views/active_storage/blobs/_blob.html.erb new file mode 100644 index 0000000000..2b17745c8d --- /dev/null +++ b/app/views/active_storage/blobs/_blob.html.erb @@ -0,0 +1,7 @@ +<h2>Engine <code>blob/_blob</code>:</h2> + +<%= debug blob %> + +<figure> + <%= image_tag rails_blob_path(blob) %> +</figure> diff --git a/lib/active_text/attachment.rb b/lib/active_text/attachment.rb index 870390f63e..e349c721b2 100644 --- a/lib/active_text/attachment.rb +++ b/lib/active_text/attachment.rb @@ -74,7 +74,11 @@ module ActiveText end def to_html - HtmlConversion.node_to_html(node) + if attachable.respond_to?(:to_partial_path) + ApplicationController.render(self) + else + HtmlConversion.node_to_html(node) + end end def to_s diff --git a/lib/active_text/content.rb b/lib/active_text/content.rb index 0154cea17e..c9546fb4c5 100644 --- a/lib/active_text/content.rb +++ b/lib/active_text/content.rb @@ -46,7 +46,7 @@ module ActiveText end def to_html - fragment.to_html + render_attachments(&:to_html).to_html end def to_s |