Module: Maglove::Widgets::Button::Helpers

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

Instance Method Summary collapse

Instance Method Details

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



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/maglove/widgets/button.rb', line 40

def button_widget(options = {}, contents = nil, &block)
  if options.class.name == "String"
    contents = options
    options = {}
  end
  widget_block(Widgets::Button.new(options)) do |widget|
    haml_tag :a, widget.button_options do
      if widget.options[:media] and !widget.options[:media].blank?
        haml_tag :video do
          haml_tag :source, { src: widget.options[:media], type: "video/mp4" }
        end
      end
      haml_concat(contents) if contents
      yield if block
    end
  end
end