Class: Maglove::Widget::LegacyScrollableImage

Inherits:
V1
  • Object
show all
Defined in:
lib/maglove/widget/scrollable_image.rb

Instance Attribute Summary

Attributes inherited from Base

#options, #scope

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

#defaultsObject



22
23
24
25
26
27
28
29
# File 'lib/maglove/widget/scrollable_image.rb', line 22

def defaults
  {
    source: false,
    show_navigation: true,
    height: "400px",
    margin_bottom: "0px"
  }
end

#identifierObject



18
19
20
# File 'lib/maglove/widget/scrollable_image.rb', line 18

def identifier
  "scrollable_image"
end

#render(&block) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/maglove/widget/scrollable_image.rb', line 31

def render(&block)
  super do
    haml_tag :div, class: "scrollable-image-container #{options[:show_navigation] ? 'show-navigation' : ''}", style: style_string(options, :margin, :padding, :height) do
      haml_tag :div, class: "scrollable-image-inner" do
        haml_tag :img, class: "scrollable-image", src: options[:source]
        yield if block
      end
      if options[:show_navigation]
        haml_tag :div, class: "scrollable-image-navigator scrollable-image-navigator-left"
        haml_tag :div, class: "scrollable-image-navigator scrollable-image-navigator-right"
      end
    end
  end
end