maglove-widgets 1.1.9 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1eb5cd011e1042cd44a2baaa9f11a8f9403957c5
4
- data.tar.gz: 171a8610081e015bdb38b1750663a67252b46a2d
3
+ metadata.gz: 2542b44bbf19c26ed7dcabe16a07c5f24c628178
4
+ data.tar.gz: 4688b2ad33b157f0bc1ad5087b79b36ea28bf2f6
5
5
  SHA512:
6
- metadata.gz: 743056e8d8b6aba7a112f60ef688c876b32c7a96888ec3ba97f2c12f8c6b2a04cb52779d06311c5c7da24318a93fadd1a39daaaf030b66b8e6a066a0ccfcba41
7
- data.tar.gz: b0cb6ec8c3fa90db057ca4272f78aef7d88635f0ea74dd8aebc40faa86b05c3aaad3fe83fa32f9a0cee240cd0f01f895e77ba16546e724c67e957758dc60a842
6
+ metadata.gz: 0b54cf13eb3d8ae71dc8b4198d1bf8c0568189565d9bbfefa43fd74b738d240da3acc646403e9e9430f5dec9f1559b0e713a31f401ea97b1fc72b26044b3dcb1
7
+ data.tar.gz: c892ae7b1c20a78dd42e1bb5d4c1b8e9d84cbfe2153b3ba5f39c67ccc49f54c7f9631044424675531dcbd226d1e894669793261e57f1e69e380e57e4c9e5f968
@@ -1,24 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- maglove-widgets (1.1.9)
5
- bundler (~> 1.14)
6
- hamloft (~> 0.2)
4
+ maglove-widgets (2.0.0)
5
+ bundler (~> 1.10)
6
+ haml (~> 4.0)
7
+ hamloft (~> 0.2.4)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
11
- haml (5.0.4)
12
- temple (>= 0.8.0)
12
+ haml (4.0.7)
13
13
  tilt
14
- hamloft (0.2.7)
15
- haml (~> 5.0)
16
- nokogiri (~> 1.8)
17
- mini_portile2 (2.3.0)
18
- nokogiri (1.8.2)
19
- mini_portile2 (~> 2.3.0)
20
- temple (0.8.0)
21
- tilt (2.0.8)
14
+ hamloft (0.2.4)
15
+ haml (~> 4.0)
16
+ nokogiri (~> 1.6)
17
+ mini_portile2 (2.1.0)
18
+ nokogiri (1.7.0.1)
19
+ mini_portile2 (~> 2.1.0)
20
+ tilt (2.0.7)
22
21
 
23
22
  PLATFORMS
24
23
  ruby
@@ -27,4 +26,4 @@ DEPENDENCIES
27
26
  maglove-widgets!
28
27
 
29
28
  BUNDLED WITH
30
- 1.16.1
29
+ 1.14.6
@@ -6,9 +6,7 @@ require "maglove/widgets/container"
6
6
  require "maglove/widgets/heading"
7
7
  require "maglove/widgets/horizontal_rule"
8
8
  require "maglove/widgets/image"
9
- require "maglove/widgets/listitem"
10
9
  require "maglove/widgets/paragraph"
11
- require "maglove/widgets/raw_html"
12
10
  require "maglove/widgets/scrollable_image"
13
11
  require "maglove/widgets/slider"
14
12
  require "maglove/widgets/video"
@@ -24,9 +22,7 @@ module Maglove
24
22
  Hamloft.register_widget(Heading)
25
23
  Hamloft.register_widget(HorizontalRule)
26
24
  Hamloft.register_widget(Image)
27
- Hamloft.register_widget(Listitem)
28
25
  Hamloft.register_widget(Paragraph)
29
- Hamloft.register_widget(RawHtml)
30
26
  Hamloft.register_widget(ScrollableImage)
31
27
  Hamloft.register_widget(Slider)
32
28
  Hamloft.register_widget(Video)
@@ -17,16 +17,19 @@ module Maglove
17
17
  end
18
18
 
19
19
  def typeloft_widget_options
20
+ classes = ["_typeloft_widget", "#{identifier.dasherize}-widget"]
21
+ classes.push("mobile-#{@options[:mobile]}") if @options[:mobile]
20
22
  attributes = {
21
- :class => "_typeloft_widget",
23
+ :class => classes.join(" "),
22
24
  :"data-widget-identifier" => identifier
23
25
  }
24
- @options.each do |k, v|
25
- if k == :padding or k == :margin
26
- [:top, :right, :bottom, :left].each do |dir|
27
- attributes["data-attribute-#{k}_#{dir}"] = v
28
- end
29
- end
26
+ widget_style_keys = [:padding, :padding_top, :padding_bottom, :padding_left, :padding_right, :background_color, :background_image, :background_size, :background_position]
27
+ widget_options = @options.except(*widget_style_keys)
28
+ styles = @options.slice(*widget_style_keys)
29
+ attributes[:style] = style_string(styles, :padding, :background_color, :background_size, :background_position) do |sb|
30
+ sb.add(:background_image, styles[:background_image], "url(<%= value %>)")
31
+ end
32
+ widget_options.each do |k, v|
30
33
  attributes["data-attribute-#{k}"] = v
31
34
  end
32
35
  attributes
@@ -7,42 +7,26 @@ module Maglove
7
7
 
8
8
  def defaults
9
9
  {
10
- animate: "none",
11
- image_source: false,
12
- image_position: "center_center",
13
- image_size: "cover",
14
- parallax_effect: "none",
15
- parallax_speed: 0.6,
16
- background_color: "",
17
- bg_color: "",
18
- opacity: "",
19
- border_radius: "",
20
- border_width: "",
21
- border_color: "#111111",
22
- border_style: "",
23
- style: "default",
24
- padding_top: "",
25
- padding_right: "",
26
- padding_bottom: "",
27
- padding_left: "",
28
- alignment: "center",
29
- min_height: "",
30
- max_height: "",
31
- max_width: "",
32
- margin_top: "",
33
- margin_right: "",
34
- margin_bottom: "",
35
- margin_left: "",
36
- overflow_y: ""
10
+ animate: "none",
11
+ image_source: false,
12
+ image_position: "center_center",
13
+ parallax_effect: "none",
14
+ bg_color: "",
15
+ opacity: "",
16
+ border_radius: "",
17
+ border_width: "",
18
+ border_style: "",
19
+ border_color: "transparent",
20
+ style: "default",
21
+ min_height: "",
22
+ max_height: "",
23
+ overflow_y: ""
37
24
  }
38
25
  end
39
26
 
40
27
  def container_options
41
28
  result = { class: container_classes, style: container_styles }
42
- if !@options[:parallax_effect].empty? and @options[:parallax_effect] != "none"
43
- result["data-parallax-style"] = @options[:parallax_effect]
44
- result["data-parallax-speed"] = @options[:parallax_speed]
45
- end
29
+ result["data-parallax-style"] = @options[:parallax_effect] if !@options[:parallax_effect].empty? and @options[:parallax_effect] != "none"
46
30
  result
47
31
  end
48
32
 
@@ -54,36 +38,16 @@ module Maglove
54
38
  classes = ["one-container"]
55
39
  classes.push("animate #{@options[:animate]}") if @options[:animate] != "none"
56
40
  classes.push("container-#{@options[:style]}") unless @options[:style].empty?
57
- classes.push("container-image-#{@options[:image_size]}") unless @options[:image_size].empty?
58
41
  classes.push("container-parallax") if !@options[:parallax_effect].empty? and @options[:parallax_effect] != "none"
59
42
  classes.join(" ")
60
43
  end
61
44
 
62
45
  def container_styles
63
- style_string @options, :opacity, :border, :opacity, :border_radius, :border_width, :border_color, :border_style, :margin do |sb|
64
- sb.add(:background_color, @options[:background_color] == "custom" ? @options[:bg_color] : nil)
65
- if @options[:background_color] == "overlay"
66
- sb.add(:background_image, @options[:image_source], "linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url(<%= value %>)")
67
- elsif
68
- sb.add(:background_image, @options[:image_source], "url(<%= value %>)")
69
- end
70
- sb.add(:background_position, @options[:image_position], "<%= value.split('_').join(' ') %>")
71
- end
46
+ style_string @options, :opacity, :border, :opacity, :border_radius, :border_width, :border_style, :border_color, :min_height
72
47
  end
73
48
 
74
49
  def image_styles
75
- if @options[:alignment] == "left"
76
- @options[:margin_left] = "0"
77
- @options[:margin_right] = "auto"
78
- elsif @options[:alignment] == "right"
79
- @options[:margin_left] = "auto"
80
- @options[:margin_right] = "0"
81
- else
82
- @options[:margin_left] = "auto"
83
- @options[:margin_right] = "auto"
84
- end
85
-
86
- style_string @options, :min_height, :max_height, :max_width, :padding, :overflow_y, :margin_left, :margin_right
50
+ style_string @options, :max_height, :overflow_y
87
51
  end
88
52
 
89
53
  module Helpers
@@ -100,4 +64,4 @@ module Maglove
100
64
  end
101
65
  end
102
66
  end
103
- end
67
+ end
@@ -10,9 +10,7 @@ module Maglove
10
10
  type: "h1",
11
11
  style: "default",
12
12
  align: "left",
13
- margin_bottom: "1em",
14
- line_height: "",
15
- letter_spacing: ""
13
+ line_height: ""
16
14
  }
17
15
  end
18
16
 
@@ -23,8 +21,8 @@ module Maglove
23
21
  options = {}
24
22
  end
25
23
  widget_block(Widgets::Heading.new(options)) do |widget|
26
- haml_tag :header, class: "#{widget.options[:style]} align-#{widget.options[:align]}", style: style_string(widget.options, :margin, :padding) do
27
- haml_tag widget.options[:type], class: "_typeloft_editable _typeloft_widget_autoselect", style: style_string(widget.options, :line_height, :letter_spacing) do
24
+ haml_tag :header, class: "#{widget.options[:style]} align-#{widget.options[:align]}" do
25
+ haml_tag widget.options[:type], class: "_typeloft_editable _typeloft_widget_autoselect", style: style_string(widget.options, :line_height) do
28
26
  haml_concat(contents) if contents
29
27
  yield if block
30
28
  end
@@ -9,12 +9,8 @@ module Maglove
9
9
  {
10
10
  style: "img-responsive",
11
11
  align: "center",
12
- title: "",
13
12
  source: false,
14
13
  magnify: false,
15
- margin_bottom: "0",
16
- max_width: "100%",
17
- min_width: "0",
18
14
  tooltip_icon: "bullhorn",
19
15
  tooltip_text_alignment: "justify",
20
16
  tooltip_text_size: "medium",
@@ -37,14 +33,14 @@ module Maglove
37
33
  module Helpers
38
34
  def image_widget(options = {})
39
35
  widget_block(Widgets::Image.new(options)) do |widget|
40
- haml_tag :div, class: widget.image_classes, style: "min-width: #{widget.options[:min_width]}; max-width: #{widget.options[:max_width]}; #{style_string(widget.options, :margin, :padding)}" do
36
+ haml_tag :div, class: widget.image_classes do
41
37
  if widget.popup?
42
38
  haml_tag :i, class: "popup fa fa-lg fa-#{widget.options[:tooltip_icon]}"
43
39
  haml_tag :div, class: "popup-box", style: "font-size: #{widget.options[:tooltip_text_size]}, text-align: #{widget.options[:tooltip_text_alignment]};" do
44
40
  haml_concat(widget.options[:tooltip_text])
45
41
  end
46
42
  end
47
- haml_tag :img, class: "image #{widget.options[:style]} #{widget.options[:magnify] ? 'magnific-image' : ''}", src: widget.options[:source], title: widget.options[:title]
43
+ haml_tag :img, class: "image #{widget.options[:style]} #{widget.options[:magnify] ? 'magnific-image' : ''}", src: widget.options[:source]
48
44
  haml_tag :div, class: "image-drop-target"
49
45
  end
50
46
  end
@@ -54,7 +50,7 @@ module Maglove
54
50
  widget_block(Widgets::Image.new(options)) do |widget|
55
51
  haml_tag :div, class: "image-widget align-#{widget.options[:align]}" do
56
52
  link options[:href] do
57
- haml_tag :img, style: style_string(widget.options, :margin, :padding), class: "image #{widget.options[:style]} #{widget.options[:magnify] ? 'magnific-image' : ''}", src: widget.options[:source]
53
+ haml_tag :img, class: "image #{widget.options[:style]} #{widget.options[:magnify] ? 'magnific-image' : ''}", src: widget.options[:source]
58
54
  end
59
55
  haml_tag :div, class: "image-drop-target"
60
56
  end
@@ -10,7 +10,6 @@ module Maglove
10
10
  style: "default",
11
11
  align: "left",
12
12
  size: "md",
13
- margin_bottom: "1em",
14
13
  drop_cap: "",
15
14
  drop_cap_color: "#000000",
16
15
  line_height: ""
@@ -24,12 +23,10 @@ module Maglove
24
23
  options = {}
25
24
  end
26
25
  widget_block(Widgets::Paragraph.new(options)) do |widget|
27
- haml_tag :div, style: style_string(widget.options, :margin, :padding), class: "paragraph #{widget.options[:style]} align-#{widget.options[:align]} size-#{widget.options[:size]}" do
26
+ haml_tag :div, style: style_string(widget.options, :padding), class: "paragraph #{widget.options[:style]} align-#{widget.options[:align]} size-#{widget.options[:size]}" do
28
27
  unless widget.options[:drop_cap].empty?
29
- if widget.options[:style].include?('inverse-dropcap')
30
- set_dropcap widget, "background-color"
31
- else
32
- set_dropcap widget, "color"
28
+ haml_tag :span, class: "__dropcap", style: "color: #{widget.options[:drop_cap_color]};" do
29
+ haml_concat(widget.options[:drop_cap])
33
30
  end
34
31
  end
35
32
 
@@ -40,12 +37,6 @@ module Maglove
40
37
  end
41
38
  end
42
39
  end
43
-
44
- def set_dropcap widget, color_attribute
45
- haml_tag :span, class: "__dropcap", style: "#{color_attribute}: #{widget.options[:drop_cap_color]};" do
46
- haml_concat(widget.options[:drop_cap])
47
- end
48
- end
49
40
  end
50
41
  end
51
42
  end
@@ -15,12 +15,11 @@ module Maglove
15
15
  end
16
16
 
17
17
  module Helpers
18
- def scrollable_image_widget(options = {}, &block)
18
+ def scrollable_image_widget(options = {})
19
19
  widget_block(Widgets::ScrollableImage.new(options)) do |widget|
20
20
  haml_tag :div, class: "scrollable-image-container #{widget.options[:show_navigation] ? 'show-navigation' : ''}", style: style_string(widget.options, :margin, :padding, :height) do
21
21
  haml_tag :div, class: "scrollable-image-inner" do
22
22
  haml_tag :img, class: "scrollable-image", src: widget.options[:source]
23
- yield if block
24
23
  end
25
24
  if widget.options[:show_navigation]
26
25
  haml_tag :div, class: "scrollable-image-navigator scrollable-image-navigator-left"
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "maglove-widgets"
6
- s.version = "1.1.9"
6
+ s.version = "2.0.0"
7
7
  s.licenses = ["BSD-3-Clause"]
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Tobias Strebitzer"]
@@ -11,8 +11,9 @@ Gem::Specification.new do |s|
11
11
  s.homepage = "https://bitbucket.org/MagLoft/maglove-widgets"
12
12
  s.summary = "MagLove Widgets Repository"
13
13
  s.description = "This gem contains shared widgets for MagLove."
14
- s.add_runtime_dependency "bundler", "~> 1.14"
15
- s.add_runtime_dependency 'hamloft', "~> 0.2"
14
+ s.add_runtime_dependency "bundler", "~> 1.10"
15
+ s.add_runtime_dependency 'haml', "~> 4.0"
16
+ s.add_runtime_dependency 'hamloft', "~> 0.2.4"
16
17
  s.files = `git ls-files`.split("\n")
17
18
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
18
19
  s.require_path = 'lib'
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: 1.1.9
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Strebitzer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-06 00:00:00.000000000 Z
11
+ date: 2017-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.14'
19
+ version: '1.10'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.14'
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: haml
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: hamloft
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '0.2'
47
+ version: 0.2.4
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '0.2'
54
+ version: 0.2.4
41
55
  description: This gem contains shared widgets for MagLove.
42
56
  email:
43
57
  - tobias.strebitzer@magloft.com
@@ -59,9 +73,7 @@ files:
59
73
  - lib/maglove/widgets/heading.rb
60
74
  - lib/maglove/widgets/horizontal_rule.rb
61
75
  - lib/maglove/widgets/image.rb
62
- - lib/maglove/widgets/listitem.rb
63
76
  - lib/maglove/widgets/paragraph.rb
64
- - lib/maglove/widgets/raw_html.rb
65
77
  - lib/maglove/widgets/scrollable_image.rb
66
78
  - lib/maglove/widgets/slider.rb
67
79
  - lib/maglove/widgets/video.rb
@@ -1,68 +0,0 @@
1
- module Maglove
2
- module Widgets
3
- class Listitem < Base
4
- def identifier
5
- "listitem"
6
- end
7
-
8
- def defaults
9
- {
10
- background_color: "#18B545",
11
- text_color: "#FFFFFF",
12
- arrow_color: "#FFFFFF",
13
- size: "md",
14
- badge: nil,
15
- badge_color: "#FFFFFF",
16
- badge_background: "rgba(255, 255, 255, 0.25)",
17
- badge_width: "24px",
18
- title: "Title",
19
- subtitle: nil,
20
- subtitle_style: "normal",
21
- image_source: nil
22
- }
23
- end
24
-
25
- def styles
26
- style_string @options, :border_color, :background_color
27
- end
28
-
29
- module Helpers
30
- def listitem_widget(options = {})
31
- widget_block(Widgets::Listitem.new(options)) do |widget|
32
- haml_tag :a, { class: "list-item list-item-#{widget.options[:size]}", href: (widget.options[:href] or "#"), style: widget.styles } do
33
- if widget.options[:icon]
34
- haml_tag :i, { class: "list-item-icon fa fa-#{widget.options[:icon]}" }
35
- end
36
- if widget.options[:image_source]
37
- image_style = style_string(widget.options) do |sb|
38
- sb.add(:background_image, widget.options[:image_source], "url(<%= value %>)")
39
- end
40
- haml_tag :div, { class: "list-item-image", style: image_style }
41
- end
42
- haml_tag :div, { class: "list-item-main" } do
43
- haml_tag :div, { class: "list-item-title", style: "color: #{widget.options[:text_color]}" } do
44
- haml_concat(widget.options[:title])
45
- end
46
- if widget.options[:subtitle]
47
- haml_tag :div, { class: "list-item-subtitle", style: "color: #{widget.options[:text_color]}; font-style: #{widget.options[:subtitle_style]}" } do
48
- haml_concat(widget.options[:subtitle])
49
- end
50
- end
51
- end
52
- if widget.options[:badge]
53
- haml_tag :div, { class: "list-item-badge" } do
54
- haml_tag :span, { style: "color: #{widget.options[:badge_color]}; background-color: #{widget.options[:badge_background]}; width: #{widget.options[:badge_width]};" } do
55
- haml_concat(widget.options[:badge])
56
- end
57
- end
58
- end
59
- if widget.options[:href]
60
- haml_tag :i, { class: "list-item-arrow fa fa-angle-right", style: "color: #{widget.options[:arrow_color]}" }
61
- end
62
- end
63
- end
64
- end
65
- end
66
- end
67
- end
68
- end
@@ -1,26 +0,0 @@
1
- module Maglove
2
- module Widgets
3
- class RawHtml < Base
4
- def identifier
5
- "raw_html"
6
- end
7
-
8
- def defaults
9
- {
10
- src: "",
11
- css: ""
12
- }
13
- end
14
-
15
- module Helpers
16
- def raw_html_widget(options = {}, &block)
17
- widget_block(Widgets::RawHtml.new(options)) do |widget|
18
- haml_tag :div, class: "iframe-container", style: style_string(widget.options, :margin, :padding) do
19
- haml_tag :iframe, src: widget.options[:src], style: widget.options[:css]
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end