maglove-widgets 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +21 -3
- data/lib/maglove/widgets.rb +11 -15
- data/lib/maglove/widgets/base.rb +13 -12
- data/lib/maglove/widgets/button.rb +6 -15
- data/lib/maglove/widgets/columns.rb +16 -37
- data/lib/maglove/widgets/container.rb +5 -14
- data/lib/maglove/widgets/heading.rb +4 -13
- data/lib/maglove/widgets/horizontal_rule.rb +2 -6
- data/lib/maglove/widgets/image.rb +8 -23
- data/lib/maglove/widgets/paragraph.rb +8 -18
- data/lib/maglove/widgets/scrollable_image.rb +8 -12
- data/lib/maglove/widgets/slider.rb +5 -7
- data/lib/maglove/widgets/video.rb +4 -8
- data/lib/maglove/widgets/youtube.rb +3 -7
- data/maglove-widgets.gemspec +2 -2
- metadata +4 -6
- data/lib/maglove/widgets/banner.rb +0 -28
- data/lib/maglove/widgets/yahoo_screen.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6d313d5d40f00cecfebc2e1877d4faaf6abeb30
|
4
|
+
data.tar.gz: 15f0973cb9c2abe6728352fdef754cd2def23019
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fbd028124eca752499ab7a215e91c90fe55e9cfe532a617cde665bb576ae70b8d8c48a35b8beb8f256bdf4b0cade3f2be1cabcc9d0ca080d7af7398b9d14f4d
|
7
|
+
data.tar.gz: bb853595b8e9a5087b2e0cbf236ea8a2cb621e5644f2d1eb01203e22538f88490381b3dc032236ec2bfbcba98b77ff9f69c411f4026e828abe89381ce71eb6d6
|
data/.rubocop.yml
CHANGED
@@ -12,14 +12,14 @@ Lint/UselessAssignment:
|
|
12
12
|
- '**/spec/**/*'
|
13
13
|
|
14
14
|
# We could potentially enable the 2 below:
|
15
|
-
|
15
|
+
Layout/IndentHash:
|
16
16
|
Enabled: false
|
17
17
|
|
18
|
-
|
18
|
+
Layout/AlignHash:
|
19
19
|
Enabled: false
|
20
20
|
|
21
21
|
# HoundCI doesn't like this rule
|
22
|
-
|
22
|
+
Layout/DotPosition:
|
23
23
|
Enabled: false
|
24
24
|
|
25
25
|
# We allow !! as it's an easy way to convert ot boolean
|
@@ -129,7 +129,7 @@ Style/PerlBackrefs:
|
|
129
129
|
Enabled: false
|
130
130
|
|
131
131
|
# Disable '+ should be surrounded with a single space' for xcodebuild_spec.rb
|
132
|
-
|
132
|
+
Layout/SpaceAroundOperators:
|
133
133
|
Exclude:
|
134
134
|
- '**/spec/actions_specs/xcodebuild_spec.rb'
|
135
135
|
|
@@ -139,6 +139,8 @@ AllCops:
|
|
139
139
|
Exclude:
|
140
140
|
- './vendor/**/*'
|
141
141
|
- db/schema.rb
|
142
|
+
- Gemfile
|
143
|
+
- maglove-widgets.gemspec
|
142
144
|
|
143
145
|
# We're not there yet
|
144
146
|
Style/Documentation:
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,29 +1,47 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
maglove-widgets (2.0.
|
5
|
-
hamloft (~>
|
4
|
+
maglove-widgets (2.0.2)
|
5
|
+
hamloft (~> 2.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
ast (2.3.0)
|
10
11
|
haml (5.0.2)
|
11
12
|
temple (>= 0.8.0)
|
12
13
|
tilt
|
13
|
-
hamloft (0.2
|
14
|
+
hamloft (2.0.2)
|
14
15
|
haml (~> 5.0)
|
15
16
|
nokogiri (~> 1.8)
|
16
17
|
mini_portile2 (2.2.0)
|
17
18
|
nokogiri (1.8.0)
|
18
19
|
mini_portile2 (~> 2.2.0)
|
20
|
+
parallel (1.12.0)
|
21
|
+
parser (2.4.0.0)
|
22
|
+
ast (~> 2.2)
|
23
|
+
powerpack (0.1.1)
|
24
|
+
rainbow (2.2.2)
|
25
|
+
rake
|
26
|
+
rake (12.0.0)
|
27
|
+
rubocop (0.49.1)
|
28
|
+
parallel (~> 1.10)
|
29
|
+
parser (>= 2.3.3.1, < 3.0)
|
30
|
+
powerpack (~> 0.1)
|
31
|
+
rainbow (>= 1.99.1, < 3.0)
|
32
|
+
ruby-progressbar (~> 1.7)
|
33
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
34
|
+
ruby-progressbar (1.8.1)
|
19
35
|
temple (0.8.0)
|
20
36
|
tilt (2.0.8)
|
37
|
+
unicode-display_width (1.3.0)
|
21
38
|
|
22
39
|
PLATFORMS
|
23
40
|
ruby
|
24
41
|
|
25
42
|
DEPENDENCIES
|
26
43
|
maglove-widgets!
|
44
|
+
rubocop
|
27
45
|
|
28
46
|
BUNDLED WITH
|
29
47
|
1.15.1
|
data/lib/maglove/widgets.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "maglove/widgets/base"
|
2
|
-
require "maglove/widgets/banner"
|
3
2
|
require "maglove/widgets/button"
|
4
3
|
require "maglove/widgets/columns"
|
5
4
|
require "maglove/widgets/container"
|
@@ -10,23 +9,20 @@ require "maglove/widgets/paragraph"
|
|
10
9
|
require "maglove/widgets/scrollable_image"
|
11
10
|
require "maglove/widgets/slider"
|
12
11
|
require "maglove/widgets/video"
|
13
|
-
require "maglove/widgets/yahoo_screen"
|
14
12
|
require "maglove/widgets/youtube"
|
15
13
|
|
16
14
|
module Maglove
|
17
15
|
module Widgets
|
18
|
-
Hamloft.register_widget(
|
19
|
-
Hamloft.register_widget(
|
20
|
-
Hamloft.register_widget(
|
21
|
-
Hamloft.register_widget(
|
22
|
-
Hamloft.register_widget(
|
23
|
-
Hamloft.register_widget(
|
24
|
-
Hamloft.register_widget(
|
25
|
-
Hamloft.register_widget(
|
26
|
-
Hamloft.register_widget(
|
27
|
-
Hamloft.register_widget(
|
28
|
-
Hamloft.register_widget(
|
29
|
-
Hamloft.register_widget(YahooScreen)
|
30
|
-
Hamloft.register_widget(Youtube)
|
16
|
+
Hamloft.register_widget(:button, Button)
|
17
|
+
Hamloft.register_widget(:columns, Columns)
|
18
|
+
Hamloft.register_widget(:container, Container)
|
19
|
+
Hamloft.register_widget(:heading, Heading)
|
20
|
+
Hamloft.register_widget(:horizontal_rule, HorizontalRule)
|
21
|
+
Hamloft.register_widget(:image, Image)
|
22
|
+
Hamloft.register_widget(:paragraph, Paragraph)
|
23
|
+
Hamloft.register_widget(:scrollable_image, ScrollableImage)
|
24
|
+
Hamloft.register_widget(:slider, Slider)
|
25
|
+
Hamloft.register_widget(:video, Video)
|
26
|
+
Hamloft.register_widget(:youtube, Youtube)
|
31
27
|
end
|
32
28
|
end
|
data/lib/maglove/widgets/base.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
module Maglove
|
2
2
|
module Widgets
|
3
3
|
class Base
|
4
|
+
extend Forwardable
|
4
5
|
include Hamloft::Helpers
|
5
|
-
|
6
|
+
attr_reader :options, :scope
|
7
|
+
def_delegators :@scope, :haml_tag, :haml_concat
|
6
8
|
|
7
9
|
def identifier
|
8
10
|
"base"
|
@@ -12,29 +14,28 @@ module Maglove
|
|
12
14
|
{}
|
13
15
|
end
|
14
16
|
|
15
|
-
def initialize(options)
|
17
|
+
def initialize(options, scope)
|
16
18
|
@options = defaults.merge(options)
|
19
|
+
@scope = scope
|
17
20
|
end
|
18
21
|
|
19
|
-
def
|
20
|
-
|
22
|
+
def widget_options
|
23
|
+
attributes = { "type" => identifier }
|
24
|
+
classes = []
|
21
25
|
classes.push("mobile-#{@options[:mobile]}") if @options[:mobile]
|
22
|
-
attributes = {
|
23
|
-
:"data-widget-identifier" => identifier
|
24
|
-
}
|
25
26
|
if @options[:effect]
|
26
27
|
classes.push("effect")
|
27
28
|
classes.push("effect-#{@options[:effect]}")
|
28
29
|
end
|
29
|
-
attributes[
|
30
|
-
widget_style_keys = [
|
30
|
+
attributes["class"] = classes.join(" ") if classes.any?
|
31
|
+
widget_style_keys = %i[padding padding_top padding_bottom padding_left padding_right background_color background_image background_size background_position]
|
31
32
|
widget_options = @options.except(*widget_style_keys)
|
32
33
|
styles = @options.slice(*widget_style_keys)
|
33
|
-
attributes[
|
34
|
+
attributes["style"] = style_string(styles, :padding, :background_color, :background_size, :background_position) do |sb|
|
34
35
|
sb.add(:background_image, styles[:background_image], "url(<%= value %>)")
|
35
36
|
end
|
36
|
-
widget_options.each do |
|
37
|
-
attributes["
|
37
|
+
widget_options.each do |key, value|
|
38
|
+
attributes["attribute-#{key.to_s.dasherize}"] = value
|
38
39
|
end
|
39
40
|
attributes
|
40
41
|
end
|
@@ -36,23 +36,14 @@ module Maglove
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
if options
|
42
|
-
|
43
|
-
|
44
|
-
end
|
45
|
-
widget_block(Widgets::Button.new(options)) do |widget|
|
46
|
-
haml_tag :a, widget.button_options do
|
47
|
-
if widget.options[:media] and !widget.options[:media].blank?
|
48
|
-
haml_tag :video do
|
49
|
-
haml_tag :source, { src: widget.options[:media], type: "video/mp4" }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
haml_concat(contents) if contents
|
53
|
-
yield if block
|
39
|
+
def template(scope, &block)
|
40
|
+
scope.haml_tag :a, button_options do
|
41
|
+
if options[:media] and !options[:media].blank?
|
42
|
+
scope.haml_tag :video do
|
43
|
+
scope.haml_tag :source, { src: options[:media], type: "video/mp4" }
|
54
44
|
end
|
55
45
|
end
|
46
|
+
yield if block
|
56
47
|
end
|
57
48
|
end
|
58
49
|
end
|
@@ -5,8 +5,8 @@ module Maglove
|
|
5
5
|
attr_reader :column_count
|
6
6
|
attr_reader :total_columns
|
7
7
|
|
8
|
-
def initialize(options)
|
9
|
-
super(options)
|
8
|
+
def initialize(options, scope)
|
9
|
+
super(options, scope)
|
10
10
|
@column_count = 0
|
11
11
|
column_array = @options[:columns].to_s.split("x")
|
12
12
|
if column_array.length == 1
|
@@ -42,44 +42,23 @@ module Maglove
|
|
42
42
|
}
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
next_span = row.next_span
|
49
|
-
if next_span
|
50
|
-
phone_cols = row.options[:collapse_options] == "xs" ? next_span : "12"
|
51
|
-
haml_tag :div, class: "column col-#{phone_cols} col-tablet-#{next_span} col-#{row.options[:collapse_options]}-#{next_span}" do
|
52
|
-
yield if block
|
53
|
-
drop_container
|
54
|
-
end
|
55
|
-
else
|
56
|
-
haml_tag :pre do
|
57
|
-
haml_concat "ERROR: Row does not allow column at position #{row.column_count}"
|
58
|
-
end
|
59
|
-
end
|
45
|
+
def template(&block)
|
46
|
+
haml_tag :div, row_options do
|
47
|
+
yield(self) if block
|
60
48
|
end
|
49
|
+
end
|
61
50
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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
|
67
58
|
end
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
columns_widget = Widgets::Columns.new(options)
|
72
|
-
items = variable(key, [])
|
73
|
-
# calculate row and column count
|
74
|
-
row_count = (items.length.to_f / columns_widget.total_columns).ceil
|
75
|
-
col_count = columns_widget.total_columns
|
76
|
-
(0...row_count).each do |row_index|
|
77
|
-
columns_widget(options) do |row|
|
78
|
-
(0...col_count).each do |col_index|
|
79
|
-
index = (row_index * col_count) + col_index
|
80
|
-
yield(row, items[index]) unless items[index].nil?
|
81
|
-
end
|
82
|
-
end
|
59
|
+
else
|
60
|
+
haml_tag :pre do
|
61
|
+
haml_concat "ERROR: Row does not allow column at position #{column_count}"
|
83
62
|
end
|
84
63
|
end
|
85
64
|
end
|
@@ -8,11 +8,7 @@ module Maglove
|
|
8
8
|
def defaults
|
9
9
|
{
|
10
10
|
animate: "none",
|
11
|
-
image_source: false,
|
12
|
-
image_position: "center_center",
|
13
11
|
parallax_effect: "none",
|
14
|
-
bg_color: "",
|
15
|
-
opacity: "",
|
16
12
|
border_radius: "",
|
17
13
|
border_width: "",
|
18
14
|
border_style: "",
|
@@ -43,22 +39,17 @@ module Maglove
|
|
43
39
|
end
|
44
40
|
|
45
41
|
def container_styles
|
46
|
-
style_string @options, :
|
42
|
+
style_string @options, :border, :border_radius, :border_width, :border_style, :border_color, :min_height
|
47
43
|
end
|
48
44
|
|
49
45
|
def image_styles
|
50
46
|
style_string @options, :max_height, :overflow_y
|
51
47
|
end
|
52
48
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
haml_tag :div, widget.image_options do
|
58
|
-
yield if block
|
59
|
-
drop_container
|
60
|
-
end
|
61
|
-
end
|
49
|
+
def template(&block)
|
50
|
+
haml_tag :section, container_options do
|
51
|
+
haml_tag :div, image_options do
|
52
|
+
yield if block
|
62
53
|
end
|
63
54
|
end
|
64
55
|
end
|
@@ -14,19 +14,10 @@ module Maglove
|
|
14
14
|
}
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
options = {}
|
22
|
-
end
|
23
|
-
widget_block(Widgets::Heading.new(options)) do |widget|
|
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
|
26
|
-
haml_concat(contents) if contents
|
27
|
-
yield if block
|
28
|
-
end
|
29
|
-
end
|
17
|
+
def template(&block)
|
18
|
+
haml_tag :header, class: "#{options[:style]} align-#{options[:align]}" do
|
19
|
+
haml_tag options[:type], contenteditable: true, style: style_string(options, :line_height) do
|
20
|
+
yield if block
|
30
21
|
end
|
31
22
|
end
|
32
23
|
end
|
@@ -13,12 +13,8 @@ module Maglove
|
|
13
13
|
}
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
widget_block(Widgets::HorizontalRule.new(options)) do |widget|
|
19
|
-
haml_tag :hr, style: "max-height: #{widget.options[:max_height]}", class: "#{widget.options[:style]} #{widget.options[:color]}"
|
20
|
-
end
|
21
|
-
end
|
16
|
+
def template(&block)
|
17
|
+
haml_tag :hr, style: "max-height: #{options[:max_height]}", class: "#{options[:style]} #{options[:color]}"
|
22
18
|
end
|
23
19
|
end
|
24
20
|
end
|
@@ -30,31 +30,16 @@ module Maglove
|
|
30
30
|
!@options[:tooltip_text].blank?
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
haml_tag :
|
37
|
-
|
38
|
-
|
39
|
-
haml_tag :div, class: "popup-box", style: "font-size: #{widget.options[:tooltip_text_size]}, text-align: #{widget.options[:tooltip_text_alignment]};" do
|
40
|
-
haml_concat(widget.options[:tooltip_text])
|
41
|
-
end
|
42
|
-
end
|
43
|
-
haml_tag :img, class: "image #{widget.options[:style]} #{widget.options[:magnify] ? 'magnific-image' : ''}", src: widget.options[:source]
|
44
|
-
haml_tag :div, class: "image-drop-target"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def image_widget_link(options = {})
|
50
|
-
widget_block(Widgets::Image.new(options)) do |widget|
|
51
|
-
haml_tag :div, class: "image-widget align-#{widget.options[:align]}" do
|
52
|
-
link options[:href] do
|
53
|
-
haml_tag :img, class: "image #{widget.options[:style]} #{widget.options[:magnify] ? 'magnific-image' : ''}", src: widget.options[:source]
|
54
|
-
end
|
55
|
-
haml_tag :div, class: "image-drop-target"
|
33
|
+
def template(&block)
|
34
|
+
haml_tag :div, class: image_classes do
|
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])
|
56
39
|
end
|
57
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"
|
58
43
|
end
|
59
44
|
end
|
60
45
|
end
|
@@ -16,26 +16,16 @@ module Maglove
|
|
16
16
|
}
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
widget_block(Widgets::Paragraph.new(options)) do |widget|
|
26
|
-
haml_tag :div, style: style_string(widget.options, :padding), class: "paragraph #{widget.options[:style]} align-#{widget.options[:align]} size-#{widget.options[:size]}" do
|
27
|
-
unless widget.options[:drop_cap].empty?
|
28
|
-
haml_tag :span, class: "__dropcap", style: "color: #{widget.options[:drop_cap_color]};" do
|
29
|
-
haml_concat(widget.options[:drop_cap])
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
haml_tag :span, class: "paragraph-content _typeloft_editable _typeloft_widget_autoselect", style: style_string(widget.options, :line_height) do
|
34
|
-
haml_concat(contents) if contents
|
35
|
-
yield if block
|
36
|
-
end
|
19
|
+
def template(&block)
|
20
|
+
scope.haml_tag :div, style: style_string(options, :padding), class: "paragraph #{options[:style]} align-#{options[:align]} size-#{options[:size]}" do
|
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])
|
37
24
|
end
|
38
25
|
end
|
26
|
+
haml_tag :span, contenteditable: true, class: "paragraph-content", style: style_string(options, :line_height) do
|
27
|
+
yield if block
|
28
|
+
end
|
39
29
|
end
|
40
30
|
end
|
41
31
|
end
|
@@ -14,18 +14,14 @@ module Maglove
|
|
14
14
|
}
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
haml_tag :
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
haml_tag :div, class: "scrollable-image-navigator scrollable-image-navigator-left"
|
26
|
-
haml_tag :div, class: "scrollable-image-navigator scrollable-image-navigator-right"
|
27
|
-
end
|
28
|
-
end
|
17
|
+
def template(&block)
|
18
|
+
haml_tag :div, class: "scrollable-image-container #{options[:show_navigation] ? 'show-navigation' : ''}", style: style_string(options, :margin, :padding, :height) do
|
19
|
+
haml_tag :div, class: "scrollable-image-inner" do
|
20
|
+
haml_tag :img, class: "scrollable-image", src: options[:source]
|
21
|
+
end
|
22
|
+
if options[:show_navigation]
|
23
|
+
haml_tag :div, class: "scrollable-image-navigator scrollable-image-navigator-left"
|
24
|
+
haml_tag :div, class: "scrollable-image-navigator scrollable-image-navigator-right"
|
29
25
|
end
|
30
26
|
end
|
31
27
|
end
|
@@ -35,15 +35,13 @@ module Maglove
|
|
35
35
|
classes.join(" ")
|
36
36
|
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
haml_tag :div, widget.slider_options do
|
42
|
-
yield if block
|
43
|
-
end
|
44
|
-
end
|
38
|
+
def template(&block)
|
39
|
+
haml_tag :div, slider_options do
|
40
|
+
yield if block
|
45
41
|
end
|
42
|
+
end
|
46
43
|
|
44
|
+
module Helpers
|
47
45
|
def slider_item(options = {}, &block)
|
48
46
|
haml_tag :div, class: "item" do
|
49
47
|
yield if block
|
@@ -20,14 +20,10 @@ module Maglove
|
|
20
20
|
}
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
haml_tag :
|
27
|
-
haml_tag :video, controls: true, poster: widget.options[:poster], style: "width: 100%" do
|
28
|
-
haml_tag :source, src: widget.options[:source].to_s, type: "video/mp4"
|
29
|
-
end
|
30
|
-
end
|
23
|
+
def template(&block)
|
24
|
+
haml_tag :div, style: "margin-bottom: #{options[:margin_bottom]}", class: "video-widget player-style-#{options[:style]}" do
|
25
|
+
haml_tag :video, controls: true, poster: options[:poster], style: "width: 100%" do
|
26
|
+
haml_tag :source, src: options[:source].to_s, type: "video/mp4"
|
31
27
|
end
|
32
28
|
end
|
33
29
|
end
|
@@ -13,13 +13,9 @@ module Maglove
|
|
13
13
|
}
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
haml_tag :div, class: "flex-video widescreen", style: style_string(widget.options, :margin, :padding) do
|
20
|
-
haml_tag :iframe, src: "https://www.youtube.com/embed/#{widget.options[:youtube_id]}", type: "text/html", style: "max-width: 100%; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;", allowfullscreen: "", frameborder: "0", webkitallowfullscreen: "", mozallowfullscreen: ""
|
21
|
-
end
|
22
|
-
end
|
16
|
+
def template(&block)
|
17
|
+
haml_tag :div, class: "flex-video widescreen", style: style_string(options, :margin, :padding) do
|
18
|
+
haml_tag :iframe, src: "https://www.youtube.com/embed/#{options[:youtube_id]}", type: "text/html", style: "max-width: 100%; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;", allowfullscreen: "", frameborder: "0", webkitallowfullscreen: "", mozallowfullscreen: ""
|
23
19
|
end
|
24
20
|
end
|
25
21
|
end
|
data/maglove-widgets.gemspec
CHANGED
@@ -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 = "2.0.
|
6
|
+
s.version = "2.0.2"
|
7
7
|
s.licenses = ["BSD-3-Clause"]
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Tobias Strebitzer"]
|
@@ -11,7 +11,7 @@ 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 'hamloft', "~>
|
14
|
+
s.add_runtime_dependency 'hamloft', "~> 2.0"
|
15
15
|
s.files = `git ls-files`.split("\n")
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
17
17
|
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: 2.0.
|
4
|
+
version: 2.0.2
|
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-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hamloft
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '2.0'
|
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:
|
26
|
+
version: '2.0'
|
27
27
|
description: This gem contains shared widgets for MagLove.
|
28
28
|
email:
|
29
29
|
- tobias.strebitzer@magloft.com
|
@@ -37,7 +37,6 @@ files:
|
|
37
37
|
- Gemfile.lock
|
38
38
|
- README.md
|
39
39
|
- lib/maglove/widgets.rb
|
40
|
-
- lib/maglove/widgets/banner.rb
|
41
40
|
- lib/maglove/widgets/base.rb
|
42
41
|
- lib/maglove/widgets/button.rb
|
43
42
|
- lib/maglove/widgets/columns.rb
|
@@ -49,7 +48,6 @@ files:
|
|
49
48
|
- lib/maglove/widgets/scrollable_image.rb
|
50
49
|
- lib/maglove/widgets/slider.rb
|
51
50
|
- lib/maglove/widgets/video.rb
|
52
|
-
- lib/maglove/widgets/yahoo_screen.rb
|
53
51
|
- lib/maglove/widgets/youtube.rb
|
54
52
|
- maglove-widgets.gemspec
|
55
53
|
homepage: https://bitbucket.org/MagLoft/maglove-widgets
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Maglove
|
2
|
-
module Widgets
|
3
|
-
class Banner < Base
|
4
|
-
def identifier
|
5
|
-
"banner"
|
6
|
-
end
|
7
|
-
|
8
|
-
def defaults
|
9
|
-
{
|
10
|
-
style: "dark",
|
11
|
-
alignment: "center"
|
12
|
-
}
|
13
|
-
end
|
14
|
-
end
|
15
|
-
module Helpers
|
16
|
-
def banner_widget(options = {}, &block)
|
17
|
-
widget_block(Widgets::Banner.new(options)) do |widget|
|
18
|
-
haml_tag :div, class: "banner-outer align-#{widget.options[:alignment]}" do
|
19
|
-
haml_tag :div, class: "banner banner-#{widget.options[:style]}" do
|
20
|
-
yield if block
|
21
|
-
drop_container
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Maglove
|
2
|
-
module Widgets
|
3
|
-
class YahooScreen < Base
|
4
|
-
def identifier
|
5
|
-
"yahoo_screen"
|
6
|
-
end
|
7
|
-
|
8
|
-
def defaults
|
9
|
-
{
|
10
|
-
yahoo_screen_id: "apple-iwatch-iphone-6-135616256",
|
11
|
-
width: "800",
|
12
|
-
height: "600"
|
13
|
-
}
|
14
|
-
end
|
15
|
-
|
16
|
-
module Helpers
|
17
|
-
def yahoo_screen_widget(options = {}, &block)
|
18
|
-
widget_block(Widgets::YahooScreen.new(options)) do |widget|
|
19
|
-
haml_tag :div, class: "flex-video widescreen", style: style_string(widget.options, :margin, :padding) do
|
20
|
-
haml_tag :iframe, src: "http://screen.yahoo.com/#{widget.options[:yahoo_screen_id]}.html?format=embed", type: "text/html", style: "max-width: 100%; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;", allowfullscreen: "", frameborder: "0", webkitallowfullscreen: "", mozallowfullscreen: ""
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|