maglove-widgets 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/maglove/widgets/base.rb +7 -15
- data/lib/maglove/widgets/columns.rb +2 -45
- data/lib/maglove/widgets/container.rb +1 -32
- data/lib/maglove/widgets/heading.rb +3 -7
- data/lib/maglove/widgets/image.rb +1 -21
- data/lib/maglove/widgets/paragraph.rb +1 -11
- data/maglove-widgets.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dc7652853ab41d54619008cf3b26b415bd6da9c
|
4
|
+
data.tar.gz: 0f7c0c83f0a73d8395a9ac5b3e39af23ba9bedf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36a96c291501ff25f03864cf6dab14a9f7af047330de33de2c5918e646a1e555ecca4ea5daf3bbda0ce74497addfcc07e1431e02fa31bad0654fb9e4bd2096f7
|
7
|
+
data.tar.gz: b0cdb230efec492dd9292ec5084e8879b0706695b00f6cf05338d630d6185d47ebfbdb74ac224445ff0c3bdf6b711c1c4f7ef45eac929a88d9b6dede5478e2ce
|
data/Gemfile.lock
CHANGED
data/lib/maglove/widgets/base.rb
CHANGED
@@ -20,22 +20,14 @@ module Maglove
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def widget_options
|
23
|
-
attributes = {
|
24
|
-
|
25
|
-
|
26
|
-
if @options[:effect]
|
27
|
-
classes.push("effect")
|
28
|
-
classes.push("effect-#{@options[:effect]}")
|
23
|
+
attributes = { widget: true }
|
24
|
+
@options.each do |key, value|
|
25
|
+
attributes[key.to_s.dasherize.to_s] = value
|
29
26
|
end
|
30
|
-
attributes["
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
attributes["style"] = style_string(styles, :padding, :background_color, :background_size, :background_position) do |sb|
|
35
|
-
sb.add(:background_image, styles[:background_image], "url(<%= value %>)")
|
36
|
-
end
|
37
|
-
widget_options.each do |key, value|
|
38
|
-
attributes["attribute-#{key.to_s.dasherize}"] = value
|
27
|
+
if attributes["padding"]
|
28
|
+
attributes["padding"] = attributes["padding"].join(" ")
|
29
|
+
else
|
30
|
+
attributes["padding"] = "0 0 0 0"
|
39
31
|
end
|
40
32
|
attributes
|
41
33
|
end
|
@@ -5,62 +5,19 @@ module Maglove
|
|
5
5
|
attr_reader :column_count
|
6
6
|
attr_reader :total_columns
|
7
7
|
|
8
|
-
def initialize(options, scope)
|
9
|
-
super(options, scope)
|
10
|
-
@column_count = 0
|
11
|
-
column_array = @options[:columns].to_s.split("x")
|
12
|
-
if column_array.length == 1
|
13
|
-
@total_columns = column_array[0].to_i
|
14
|
-
@columns = Array.new(@total_columns) { 12 / @total_columns }
|
15
|
-
else
|
16
|
-
@total_columns = column_array.length
|
17
|
-
@columns = column_array
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def next_span
|
22
|
-
value = @columns[@column_count]
|
23
|
-
@column_count += 1
|
24
|
-
value
|
25
|
-
end
|
26
|
-
|
27
|
-
def row_options
|
28
|
-
{
|
29
|
-
class: "row row-#{@options[:style]}"
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
8
|
def identifier
|
34
9
|
"columns"
|
35
10
|
end
|
36
11
|
|
37
12
|
def defaults
|
38
13
|
{
|
39
|
-
|
40
|
-
style: "default",
|
14
|
+
layout: "6x6",
|
41
15
|
collapse_options: "sm"
|
42
16
|
}
|
43
17
|
end
|
44
18
|
|
45
19
|
def template(&block)
|
46
|
-
|
47
|
-
yield(self) if block
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def column(&block)
|
52
|
-
span = next_span
|
53
|
-
if span
|
54
|
-
phone_cols = options[:collapse_options] == "xs" ? span : "12"
|
55
|
-
haml_tag :div, class: "column col-#{phone_cols} col-tablet-#{span} col-#{options[:collapse_options]}-#{span}" do
|
56
|
-
yield if block
|
57
|
-
drop_container
|
58
|
-
end
|
59
|
-
else
|
60
|
-
haml_tag :pre do
|
61
|
-
haml_concat "ERROR: Row does not allow column at position #{column_count}"
|
62
|
-
end
|
63
|
-
end
|
20
|
+
yield if block
|
64
21
|
end
|
65
22
|
end
|
66
23
|
end
|
@@ -13,45 +13,14 @@ module Maglove
|
|
13
13
|
border_width: "",
|
14
14
|
border_style: "",
|
15
15
|
border_color: "transparent",
|
16
|
-
style: "default",
|
17
16
|
min_height: "",
|
18
17
|
max_height: "",
|
19
18
|
overflow_y: ""
|
20
19
|
}
|
21
20
|
end
|
22
21
|
|
23
|
-
def container_options
|
24
|
-
result = { class: container_classes, style: container_styles }
|
25
|
-
result["data-parallax-style"] = @options[:parallax_effect] if !@options[:parallax_effect].empty? and @options[:parallax_effect] != "none"
|
26
|
-
result
|
27
|
-
end
|
28
|
-
|
29
|
-
def image_options
|
30
|
-
{ class: "one-container-image", style: image_styles }
|
31
|
-
end
|
32
|
-
|
33
|
-
def container_classes
|
34
|
-
classes = ["one-container"]
|
35
|
-
classes.push("animate #{@options[:animate]}") if @options[:animate] != "none"
|
36
|
-
classes.push("container-#{@options[:style]}") unless @options[:style].empty?
|
37
|
-
classes.push("container-parallax") if !@options[:parallax_effect].empty? and @options[:parallax_effect] != "none"
|
38
|
-
classes.join(" ")
|
39
|
-
end
|
40
|
-
|
41
|
-
def container_styles
|
42
|
-
style_string @options, :border, :border_radius, :border_width, :border_style, :border_color, :min_height
|
43
|
-
end
|
44
|
-
|
45
|
-
def image_styles
|
46
|
-
style_string @options, :max_height, :overflow_y
|
47
|
-
end
|
48
|
-
|
49
22
|
def template(&block)
|
50
|
-
|
51
|
-
haml_tag :div, image_options do
|
52
|
-
yield if block
|
53
|
-
end
|
54
|
-
end
|
23
|
+
yield if block
|
55
24
|
end
|
56
25
|
end
|
57
26
|
end
|
@@ -8,18 +8,14 @@ module Maglove
|
|
8
8
|
def defaults
|
9
9
|
{
|
10
10
|
type: "h1",
|
11
|
-
style: "default",
|
12
11
|
align: "left",
|
13
|
-
line_height: ""
|
12
|
+
line_height: "1.3",
|
13
|
+
padding: "0 0 8 0"
|
14
14
|
}
|
15
15
|
end
|
16
16
|
|
17
17
|
def template(&block)
|
18
|
-
|
19
|
-
haml_tag options[:type], contenteditable: true, style: style_string(options, :line_height) do
|
20
|
-
yield if block
|
21
|
-
end
|
22
|
-
end
|
18
|
+
yield if block
|
23
19
|
end
|
24
20
|
end
|
25
21
|
end
|
@@ -19,28 +19,8 @@ module Maglove
|
|
19
19
|
}
|
20
20
|
end
|
21
21
|
|
22
|
-
def image_classes
|
23
|
-
classes = ["image-widget"]
|
24
|
-
classes.push("align-#{@options[:align]}")
|
25
|
-
classes.push("popup-position-#{@options[:tooltip_position]}") if popup?
|
26
|
-
classes.join(" ")
|
27
|
-
end
|
28
|
-
|
29
|
-
def popup?
|
30
|
-
!@options[:tooltip_text].blank?
|
31
|
-
end
|
32
|
-
|
33
22
|
def template(&block)
|
34
|
-
|
35
|
-
if popup?
|
36
|
-
haml_tag :i, class: "popup fa fa-lg fa-#{options[:tooltip_icon]}"
|
37
|
-
haml_tag :div, class: "popup-box", style: "font-size: #{options[:tooltip_text_size]}, text-align: #{options[:tooltip_text_alignment]};" do
|
38
|
-
haml_concat(options[:tooltip_text])
|
39
|
-
end
|
40
|
-
end
|
41
|
-
haml_tag :img, class: "image #{options[:style]} #{options[:magnify] ? 'magnific-image' : ''}", src: options[:source]
|
42
|
-
haml_tag :div, class: "image-drop-target"
|
43
|
-
end
|
23
|
+
yield if block
|
44
24
|
end
|
45
25
|
end
|
46
26
|
end
|
@@ -7,7 +7,6 @@ module Maglove
|
|
7
7
|
|
8
8
|
def defaults
|
9
9
|
{
|
10
|
-
style: "default",
|
11
10
|
align: "left",
|
12
11
|
size: "md",
|
13
12
|
drop_cap: "",
|
@@ -17,16 +16,7 @@ module Maglove
|
|
17
16
|
end
|
18
17
|
|
19
18
|
def template(&block)
|
20
|
-
|
21
|
-
unless options[:drop_cap].empty?
|
22
|
-
haml_tag :span, class: "__dropcap", style: "color: #{options[:drop_cap_color]};" do
|
23
|
-
haml_concat(options[:drop_cap])
|
24
|
-
end
|
25
|
-
end
|
26
|
-
haml_tag :span, contenteditable: true, class: "paragraph-content", style: style_string(options, :line_height) do
|
27
|
-
yield if block
|
28
|
-
end
|
29
|
-
end
|
19
|
+
yield if block
|
30
20
|
end
|
31
21
|
end
|
32
22
|
end
|
data/maglove-widgets.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maglove-widgets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Strebitzer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hamloft
|