Class: Maglove::Widgets::Image

Inherits:
Base
  • Object
show all
Defined in:
lib/maglove/widgets/image.rb

Defined Under Namespace

Modules: Helpers

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#initialize, #typeloft_widget_options

Constructor Details

This class inherits a constructor from Maglove::Widgets::Base

Instance Method Details

#defaultsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/maglove/widgets/image.rb', line 8

def defaults
  {
    style: "img-responsive",
    align: "center",
    title: "",
    source: false,
    magnify: false,
    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: ""
  }
end

#identifierObject



4
5
6
# File 'lib/maglove/widgets/image.rb', line 4

def identifier
  "image"
end

#image_classesObject



26
27
28
29
30
31
# File 'lib/maglove/widgets/image.rb', line 26

def image_classes
  classes = ["image-widget"]
  classes.push("align-#{@options[:align]}")
  classes.push("popup-position-#{@options[:tooltip_position]}") if popup?
  classes.join(" ")
end

#popup?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/maglove/widgets/image.rb', line 33

def popup?
  !@options[:tooltip_text].blank?
end