Class: Maglove::Widgets::Heading

Inherits:
Base
  • Object
show all
Defined in:
lib/maglove/widgets/heading.rb

Instance Attribute Summary

Attributes inherited from Base

#options, #scope

Instance Method Summary collapse

Methods inherited from Base

#initialize, #widget_options

Constructor Details

This class inherits a constructor from Maglove::Widgets::Base

Instance Method Details

#defaultsObject



8
9
10
11
12
13
14
15
# File 'lib/maglove/widgets/heading.rb', line 8

def defaults
  {
    type: "h1",
    style: "default",
    align: "left",
    line_height: ""
  }
end

#identifierObject



4
5
6
# File 'lib/maglove/widgets/heading.rb', line 4

def identifier
  "heading"
end

#template(&block) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/maglove/widgets/heading.rb', line 17

def template(&block)
  haml_tag :header, class: "#{options[:style]} align-#{options[:align]}" do
    haml_tag options[:type], contenteditable: true, style: style_string(options, :line_height) do
      yield if block
    end
  end
end