Module: ActionMosaico::ContentHelper
- Defined in:
- app/helpers/action_mosaico/content_helper.rb
Instance Method Summary collapse
-
#render_action_mosaico_attachment(attachment, locals: {}) ⇒ Object
:nodoc:.
- #render_action_mosaico_attachments(content) ⇒ Object
- #render_action_mosaico_content(content) ⇒ Object
- #sanitize_action_mosaico_content(content) ⇒ Object
Instance Method Details
#render_action_mosaico_attachment(attachment, locals: {}) ⇒ Object
:nodoc:
41 42 43 44 45 46 47 48 49 |
# File 'app/helpers/action_mosaico/content_helper.rb', line 41 def (, locals: {}) # :nodoc: = { locals: locals, object: , partial: } [:partial] = .to_attachable_partial_path if .respond_to?(:to_attachable_partial_path) [:as] = .model_name.element if .respond_to?(:model_name) render(**).chomp end |
#render_action_mosaico_attachments(content) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/helpers/action_mosaico/content_helper.rb', line 24 def (content) content. do || unless .in?(content.) .node.tap do |node| node.inner_html = , locals: { in_gallery: false } end end end. do || render(layout: , object: ) do ..map do || .node.inner_html = , locals: { in_gallery: true } .to_html end.join.html_safe end.chomp end end |
#render_action_mosaico_content(content) ⇒ Object
14 15 16 17 |
# File 'app/helpers/action_mosaico/content_helper.rb', line 14 def render_action_mosaico_content(content) self.prefix_partial_path_with_controller_namespace = false sanitize_action_mosaico_content((content)) end |
#sanitize_action_mosaico_content(content) ⇒ Object
19 20 21 22 |
# File 'app/helpers/action_mosaico/content_helper.rb', line 19 def sanitize_action_mosaico_content(content) sanitizer.sanitize(content.to_html, tags: , attributes: allowed_attributes, scrubber: scrubber).html_safe end |