Class: Maglove::Widgets::Base
- Inherits:
-
Object
- Object
- Maglove::Widgets::Base
- Includes:
- Hamloft::Helpers
- Defined in:
- lib/maglove/widgets/base.rb
Direct Known Subclasses
Banner, Button, Columns, Container, Heading, HorizontalRule, Image, Paragraph, ScrollableImage, Slider, Video, YahooScreen, Youtube
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #defaults ⇒ Object
- #identifier ⇒ Object
-
#initialize(options) ⇒ Base
constructor
A new instance of Base.
- #typeloft_widget_options ⇒ Object
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
15 16 17 |
# File 'lib/maglove/widgets/base.rb', line 15 def initialize() = defaults.merge() end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/maglove/widgets/base.rb', line 5 def end |
Instance Method Details
#defaults ⇒ Object
11 12 13 |
# File 'lib/maglove/widgets/base.rb', line 11 def defaults {} end |
#identifier ⇒ Object
7 8 9 |
# File 'lib/maglove/widgets/base.rb', line 7 def identifier "base" end |
#typeloft_widget_options ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/maglove/widgets/base.rb', line 19 def attributes = { :class => "_typeloft_widget", :"data-widget-identifier" => identifier } .each do |k, v| if k == :padding or k == :margin [:top, :right, :bottom, :left].each do |dir| attributes["data-attribute-#{k}_#{dir}"] = v end end attributes["data-attribute-#{k}"] = v end attributes end |