Sha256: 95468dc2d6f7648097c841fbc1d79706803ae827f792d7d3bff26d3e0e4b9937
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
module Maglove module Widgets class Image < Base def identifier "image" end def defaults { style: "img-responsive", align: "center", source: false, magnify: false, tooltip_icon: "bullhorn", tooltip_text_alignment: "justify", tooltip_text_size: "medium", tooltip_position: "top-right", tooltip_text: "" } end def image_classes classes = ["image-widget"] classes.push("align-#{@options[:align]}") classes.push("popup-position-#{@options[:tooltip_position]}") if popup? classes.join(" ") end def popup? !@options[:tooltip_text].blank? end def template(&block) haml_tag :div, class: image_classes do if popup? haml_tag :i, class: "popup fa fa-lg fa-#{options[:tooltip_icon]}" haml_tag :div, class: "popup-box", style: "font-size: #{options[:tooltip_text_size]}, text-align: #{options[:tooltip_text_alignment]};" do haml_concat(options[:tooltip_text]) end end haml_tag :img, class: "image #{options[:style]} #{options[:magnify] ? 'magnific-image' : ''}", src: options[:source] haml_tag :div, class: "image-drop-target" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
maglove-widgets-2.0.3 | lib/maglove/widgets/image.rb |
maglove-widgets-2.0.2 | lib/maglove/widgets/image.rb |