Class: Storefront::Components::Text
- Defined in:
- lib/storefront/components/text.rb
Constant Summary
Constants included from Helpers::ContentHelper
Helpers::ContentHelper::SCOPES, Helpers::ContentHelper::SCOPES_WITH_NAMESPACE, Helpers::ContentHelper::SCOPES_WITH_NAMESPACE_AND_NESTED_MODEL, Helpers::ContentHelper::SCOPES_WITH_NESTED_MODEL
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#component_name, #extract_classes!, #initialize, #inside?, #pointer, #render_with_pointer, #to_s
Methods included from Helpers::ContentHelper
#encoded_contents, #font_face_data_uri, #html5_time, #read_binary_file, #read_image_size, #rendered_text, #sanitize, #t?
Constructor Details
This class inherits a constructor from Storefront::Components::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Storefront::Components::Base
Instance Method Details
#extract_options!(*args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/storefront/components/text.rb', line 16 def (*args) = super(*args) [:content_html] ||= {} merge_class! [:content_html], config.content_class [:tag] ||= :p end |
#render(&block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/storefront/components/text.rb', line 4 def render(&block) template.capture_haml do template.haml_tag :article, [:outer_html] do header = template.() template.haml_concat header.gsub(/\n$/, "") if header.present? content = [:body] || [:content] content ||= template.capture(&block) if block_given? template.haml_tag [:tag], content, [:content_html] end end end |