class Maglove::Widget::V1

Public Instance Methods

drop_container() click to toggle source
# File lib/maglove/widget.rb, line 78
def drop_container
  haml_tag :div, class: '_typeloft_widget_drop_container'
end
render() { |self| ... } click to toggle source
# File lib/maglove/widget.rb, line 72
def render(&block)
  haml_tag :div, widget_options do
    yield self if block_given?
  end
end
widget_options() click to toggle source
# File lib/maglove/widget.rb, line 56
def widget_options
  attributes = {
    :class => "_typeloft_widget",
    :"data-widget-identifier" => identifier
  }
  @options.each do |k, v|
    if [:padding, :margin].include?(k)
      [:top, :right, :bottom, :left].each do |dir|
        attributes["data-attribute-#{k}_#{dir}"] = v
      end
    end
    attributes["data-attribute-#{k}"] = v
  end
  attributes
end