Module: Maglove::Widgets::Heading::Helpers

Defined in:
lib/maglove/widgets/heading.rb

Instance Method Summary collapse

Instance Method Details

#heading_widget(options = {}, contents = nil, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/maglove/widgets/heading.rb', line 19

def heading_widget(options = {}, contents = nil, &block)
  if options.class.name == "String"
    contents = options
    options = {}
  end
  widget_block(Widgets::Heading.new(options)) do |widget|
    haml_tag :header, class: "#{widget.options[:style]} align-#{widget.options[:align]}", style: style_string(widget.options, :margin, :padding) do
      haml_tag widget.options[:type], class: "_typeloft_editable _typeloft_widget_autoselect", style: style_string(widget.options, :line_height) do
        haml_concat(contents) if contents
        yield if block
      end
    end
  end
end