Class: Maglove::Widgets::ScrollableImage

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

Instance Attribute Summary

Attributes inherited from Base

#options, #scope

Instance Method Summary collapse

Methods inherited from Base

#initialize, #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
# File 'lib/maglove/widgets/scrollable_image.rb', line 8

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

#identifierObject



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

def identifier
  "scrollable_image"
end

#template(&block) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/maglove/widgets/scrollable_image.rb', line 17

def template(&block)
  haml_tag :div, class: "scrollable-image-container #{options[:show_navigation] ? 'show-navigation' : ''}", style: style_string(options, :height) do
    haml_tag :div, class: "scrollable-image-inner" do
      haml_tag :img, class: "scrollable-image", src: options[:source]
    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