Class: Maglove::Widget::LegacyParagraph
- Defined in:
- lib/maglove/widget/paragraph.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from V1
#drop_container, #widget_options
Methods inherited from Base
#initialize, #style_string, #widget_options
Constructor Details
This class inherits a constructor from Maglove::Widget::Base
Instance Method Details
#defaults ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/maglove/widget/paragraph.rb', line 24 def defaults { style: "default", align: "left", size: "md", margin_bottom: "1em", drop_cap: nil, drop_cap_color: "#000000", line_height: nil } end |
#identifier ⇒ Object
20 21 22 |
# File 'lib/maglove/widget/paragraph.rb', line 20 def identifier "paragraph" end |
#render(&block) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/maglove/widget/paragraph.rb', line 36 def render(&block) super do haml_tag :div, style: style_string(, :margin, :padding), class: "paragraph #{[:style]} align-#{[:align]} size-#{[:size]}" do unless [:drop_cap].nil? color_attr = [:style].include?('inverse-dropcap') ? "background-color" : "color" haml_tag :span, class: "__dropcap", style: "#{color_attr}: #{[:drop_cap_color]};" do haml_concat([:drop_cap]) end end haml_tag :span, style: style_string(, :line_height), class: "paragraph-content _typeloft_editable _typeloft_widget_autoselect" do yield self if block_given? end end end end |