class Maglove::Widget::LegacyImage
Public Instance Methods
defaults()
click to toggle source
# File lib/maglove/widget/image.rb, line 26 def defaults { style: "img-responsive", align: "center", title: nil, source: false, magnify: false, magnify_title: nil, margin_bottom: "0", max_width: "100%", min_width: "0", tooltip_icon: "bullhorn", tooltip_text_alignment: "justify", tooltip_text_size: "medium", tooltip_position: "top-right", tooltip_text: nil } end
identifier()
click to toggle source
# File lib/maglove/widget/image.rb, line 22 def identifier "image" end
render(&block)
click to toggle source
Calls superclass method
Maglove::Widget::V1#render
# File lib/maglove/widget/image.rb, line 45 def render(&block) super do image_class = "image-widget align-#{options[:align]}" image_class += " popup-position-#{options[:tooltip_position]}" unless options[:tooltip_text].nil? haml_tag :div, class: image_class, style: "min-width: #{options[:min_width]}; max-width: #{options[:max_width]}; #{style_string(options, :margin, :padding)}" do wrap_image_link do unless options[:tooltip_text].nil? 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], title: options[:title], data: {magnify_title: options[:magnify_title]} haml_tag :div, class: "image-drop-target" end end end end
Private Instance Methods
wrap_image_link() { || ... }
click to toggle source
# File lib/maglove/widget/image.rb, line 66 def wrap_image_link(&block) if options[:href].nil? yield else scope.link(options[:href], &block) end end