Class: Maglove::Widget::LegacyHeading

Inherits:
V1
  • Object
show all
Defined in:
lib/maglove/widget/heading.rb

Instance Attribute Summary

Attributes inherited from Base

#options, #scope

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

#defaultsObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/maglove/widget/heading.rb', line 24

def defaults
  {
    type: "h1",
    style: "default",
    align: "left",
    margin_bottom: "1em",
    line_height: nil,
    letter_spacing: nil,
    id: nil
  }
end

#identifierObject



20
21
22
# File 'lib/maglove/widget/heading.rb', line 20

def identifier
  "heading"
end

#render(&block) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/maglove/widget/heading.rb', line 36

def render(&block)
  super do
    haml_tag :header, id: options[:id].to_s, class: "#{options[:style]} align-#{options[:align]}", style: style_string(options, :margin, :padding) do
      haml_tag options[:type], class: "_typeloft_editable _typeloft_widget_autoselect", style: style_string(options, :line_height, :letter_spacing) do
        yield self if block_given?
      end
    end
  end
end