Module: Maglove::Widgets::Image::Helpers

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

Instance Method Summary collapse

Instance Method Details

#image_widget(options = {}) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/maglove/widgets/image.rb', line 37

def image_widget(options = {})
  widget_block(Widgets::Image.new(options)) do |widget|
    haml_tag :div, class: widget.image_classes, style: "min-width: #{widget.options[:min_width]}; max-width: #{widget.options[:max_width]}; #{style_string(widget.options, :margin, :padding)}" do
      if widget.popup?
        haml_tag :i, class: "popup fa fa-lg fa-#{widget.options[:tooltip_icon]}"
        haml_tag :div, class: "popup-box", style: "font-size: #{widget.options[:tooltip_text_size]}, text-align: #{widget.options[:tooltip_text_alignment]};" do
          haml_concat(widget.options[:tooltip_text])
        end
      end
      haml_tag :img, class: "image #{widget.options[:style]} #{widget.options[:magnify] ? 'magnific-image' : ''}", src: widget.options[:source]
      haml_tag :div, class: "image-drop-target"
    end
  end
end


52
53
54
55
56
57
58
59
60
61
# File 'lib/maglove/widgets/image.rb', line 52

def image_widget_link(options = {})
  widget_block(Widgets::Image.new(options)) do |widget|
    haml_tag :div, class: "image-widget align-#{widget.options[:align]}" do
      link options[:href] do
        haml_tag :img, style: style_string(widget.options, :margin, :padding), class: "image #{widget.options[:style]} #{widget.options[:magnify] ? 'magnific-image' : ''}", src: widget.options[:source]
      end
      haml_tag :div, class: "image-drop-target"
    end
  end
end