Class: Maglove::Widgets::Container
- Inherits:
-
Base
- Object
- Base
- Maglove::Widgets::Container
show all
- Defined in:
- lib/maglove/widgets/container.rb
Instance Attribute Summary
Attributes inherited from Base
#options, #scope
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #widget_options
Instance Method Details
#container_classes ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/maglove/widgets/container.rb', line 33
def container_classes
classes = ["one-container"]
classes.push("animate #{@options[:animate]}") if @options[:animate] != "none"
classes.push("container-#{@options[:style]}") unless @options[:style].empty?
classes.push("container-parallax") if !@options[:parallax_effect].empty? and @options[:parallax_effect] != "none"
classes.join(" ")
end
|
#container_options ⇒ Object
23
24
25
26
27
|
# File 'lib/maglove/widgets/container.rb', line 23
def container_options
result = { class: container_classes, style: container_styles }
result["data-parallax-style"] = @options[:parallax_effect] if !@options[:parallax_effect].empty? and @options[:parallax_effect] != "none"
result
end
|
#container_styles ⇒ Object
41
42
43
|
# File 'lib/maglove/widgets/container.rb', line 41
def container_styles
style_string @options, :border, :border_radius, :border_width, :border_style, :border_color, :min_height
end
|
#defaults ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/maglove/widgets/container.rb', line 8
def defaults
{
animate: "none",
parallax_effect: "none",
border_radius: "",
border_width: "",
border_style: "",
border_color: "transparent",
style: "default",
min_height: "",
max_height: "",
overflow_y: ""
}
end
|
#identifier ⇒ Object
4
5
6
|
# File 'lib/maglove/widgets/container.rb', line 4
def identifier
"container"
end
|
#image_options ⇒ Object
29
30
31
|
# File 'lib/maglove/widgets/container.rb', line 29
def image_options
{ class: "one-container-image", style: image_styles }
end
|
#image_styles ⇒ Object
45
46
47
|
# File 'lib/maglove/widgets/container.rb', line 45
def image_styles
style_string @options, :max_height, :overflow_y
end
|
#template(&block) ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/maglove/widgets/container.rb', line 49
def template(&block)
haml_tag :section, container_options do
haml_tag :div, image_options do
yield if block
end
end
end
|