class Maglove::Widget::LegacyButton

Public Instance Methods

button_attributes() click to toggle source
# File lib/maglove/widget/button.rb, line 40
def button_attributes
  {
    "class" => "_typeloft_editable btn btn-#{options[:style]} #{options[:size]} #{options[:type]} #{options[:media] ? 'btn-media' : ''}",
    "href" => (options[:href] or "#"),
    "style" => style_string(options, :border_radius, :border_width, :border_style, :border_color, :background_color) do |sb|
      sb.add(:border_style, "solid")
    end,
    "data-media" => options[:media]
  }
end
defaults() click to toggle source
# File lib/maglove/widget/button.rb, line 27
def defaults
  {
    background_color: "#e6e6e6",
    border_radius: "4px",
    border_width: "1px",
    border_style: "solid",
    media: false,
    size: "btn-lg",
    style: "primary",
    type: "btn-fit"
  }
end
identifier() click to toggle source
# File lib/maglove/widget/button.rb, line 23
def identifier
  "button"
end
render() { |self| ... } click to toggle source
Calls superclass method Maglove::Widget::V1#render
# File lib/maglove/widget/button.rb, line 51
def render(&block)
  super do
    haml_tag :a, button_attributes do
      if options[:media] and !options[:media].blank?
        haml_tag :video do
          haml_tag :source, { src: options[:media], type: "video/mp4" }
        end
      end
      yield self if block_given?
    end
  end
end