Class: Maglove::Widget::LegacyImage
- Defined in:
- lib/maglove/widget/image.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from V1
#drop_container, #widget_options
Methods inherited from Base
#initialize, #style_string, #widget_options
Constructor Details
This class inherits a constructor from Maglove::Widget::Base
Instance Method Details
#defaults ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# 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 ⇒ Object
22 23 24 |
# File 'lib/maglove/widget/image.rb', line 22 def identifier "image" end |
#render(&block) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/maglove/widget/image.rb', line 45 def render(&block) super do image_class = "image-widget align-#{[:align]}" image_class += " popup-position-#{[:tooltip_position]}" unless [:tooltip_text].nil? haml_tag :div, class: image_class, style: "min-width: #{[:min_width]}; max-width: #{[:max_width]}; #{style_string(, :margin, :padding)}" do wrap_image_link do unless [:tooltip_text].nil? haml_tag :i, class: "popup fa fa-lg fa-#{[:tooltip_icon]}" haml_tag :div, class: "popup-box", style: "font-size: #{[:tooltip_text_size]}, text-align: #{[:tooltip_text_alignment]};" do haml_concat([:tooltip_text]) end end haml_tag :img, class: "image #{[:style]} #{[:magnify] ? 'magnific-image' : ''}", src: [:source], title: [:title], data: {magnify_title: [:magnify_title]} haml_tag :div, class: "image-drop-target" end end end end |