class Maglove::Widget::LegacyParagraph

Public Instance Methods

defaults() click to toggle source
# 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() click to toggle source
# File lib/maglove/widget/paragraph.rb, line 20
def identifier
  "paragraph"
end
render() { |self| ... } click to toggle source
Calls superclass method Maglove::Widget::V1#render
# File lib/maglove/widget/paragraph.rb, line 36
def render(&block)
  super do
    haml_tag :div, style: style_string(options, :margin, :padding), class: "paragraph #{options[:style]} align-#{options[:align]} size-#{options[:size]}" do
      unless options[:drop_cap].nil?
        color_attr = options[:style].include?('inverse-dropcap') ? "background-color" : "color"
        haml_tag :span, class: "__dropcap", style: "#{color_attr}: #{options[:drop_cap_color]};" do
          haml_concat(options[:drop_cap])
        end
      end
      haml_tag :span, style: style_string(options, :line_height), class: "paragraph-content _typeloft_editable _typeloft_widget_autoselect" do
        yield self if block_given?
      end
    end
  end
end