maglove-engine 2.0.5

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.
@@ -0,0 +1,85 @@
1
+ module Maglove
2
+ module Widget
3
+ class Listitem < V2
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
+ end
25
+
26
+ class LegacyListitem < V1
27
+ def identifier
28
+ "listitem"
29
+ end
30
+
31
+ def defaults
32
+ {
33
+ background_color: "#18B545",
34
+ text_color: "#FFFFFF",
35
+ arrow_color: "#FFFFFF",
36
+ size: "md",
37
+ badge: nil,
38
+ badge_color: "#FFFFFF",
39
+ badge_background: "rgba(255, 255, 255, 0.25)",
40
+ badge_width: "24px",
41
+ title: "Title",
42
+ subtitle: nil,
43
+ subtitle_style: "normal",
44
+ image_source: nil
45
+ }
46
+ end
47
+
48
+ def render(&block)
49
+ super do
50
+ haml_tag :a, { class: "list-item list-item-#{options[:size]}", href: (options[:href] or "#"), style: style_string(options, :border_color, :background_color) } do
51
+ if options[:icon]
52
+ haml_tag :i, { class: "list-item-icon fa fa-#{options[:icon]}" }
53
+ end
54
+ if options[:image_source]
55
+ image_style = style_string(options) do |sb|
56
+ sb.add(:background_image, options[:image_source], "url(<%= value %>)")
57
+ end
58
+ haml_tag :div, { class: "list-item-image", style: image_style }
59
+ end
60
+ haml_tag :div, { class: "list-item-main" } do
61
+ haml_tag :div, { class: "list-item-title", style: "color: #{options[:text_color]}" } do
62
+ haml_concat(options[:title])
63
+ end
64
+ if options[:subtitle]
65
+ haml_tag :div, { class: "list-item-subtitle", style: "color: #{options[:text_color]}; font-style: #{options[:subtitle_style]}" } do
66
+ haml_concat(options[:subtitle])
67
+ end
68
+ end
69
+ end
70
+ if options[:badge]
71
+ haml_tag :div, { class: "list-item-badge" } do
72
+ haml_tag :span, { style: "color: #{options[:badge_color]}; background-color: #{options[:badge_background]}; width: #{options[:badge_width]};" } do
73
+ haml_concat(options[:badge])
74
+ end
75
+ end
76
+ end
77
+ if options[:href]
78
+ haml_tag :i, { class: "list-item-arrow fa fa-angle-right", style: "color: #{options[:arrow_color]}" }
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,39 @@
1
+ module Maglove
2
+ module Widget
3
+ class Page < V2
4
+ def identifier
5
+ "page"
6
+ end
7
+
8
+ def defaults
9
+ {
10
+ text_color: "#000000",
11
+ background_color: "#FFFFFF"
12
+ }
13
+ end
14
+ end
15
+
16
+ class LegacyPage < V1
17
+ def identifier
18
+ "page"
19
+ end
20
+
21
+ def defaults
22
+ {
23
+ text_color: "#000000",
24
+ background_color: "#FFFFFF"
25
+ }
26
+ end
27
+
28
+ def render(&block)
29
+ super do
30
+ haml_tag :div, id: "page-container" do
31
+ haml_tag :div, id: "page-contents" do
32
+ yield self if block_given?
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,53 @@
1
+ module Maglove
2
+ module Widget
3
+ class Paragraph < V2
4
+ def identifier
5
+ "paragraph"
6
+ end
7
+
8
+ def defaults
9
+ {
10
+ align: "left",
11
+ size: "md",
12
+ drop_cap: nil,
13
+ drop_cap_color: "#000000",
14
+ line_height: nil
15
+ }
16
+ end
17
+ end
18
+
19
+ class LegacyParagraph < V1
20
+ def identifier
21
+ "paragraph"
22
+ end
23
+
24
+ def defaults
25
+ {
26
+ style: "default",
27
+ align: "left",
28
+ size: "md",
29
+ margin_bottom: "1em",
30
+ drop_cap: nil,
31
+ drop_cap_color: "#000000",
32
+ line_height: nil
33
+ }
34
+ end
35
+
36
+ def render(&block)
37
+ super do
38
+ haml_tag :div, style: style_string(options, :margin, :padding), class: "paragraph #{options[:style]} align-#{options[:align]} size-#{options[:size]}" do
39
+ unless options[:drop_cap].nil?
40
+ color_attr = options[:style].include?('inverse-dropcap') ? "background-color" : "color"
41
+ haml_tag :span, class: "__dropcap", style: "#{color_attr}: #{options[:drop_cap_color]};" do
42
+ haml_concat(options[:drop_cap])
43
+ end
44
+ end
45
+ haml_tag :span, style: style_string(options, :line_height), class: "paragraph-content _typeloft_editable _typeloft_widget_autoselect" do
46
+ yield self if block_given?
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,37 @@
1
+ module Maglove
2
+ module Widget
3
+ class RawHtml < V2
4
+ def identifier
5
+ "raw_html"
6
+ end
7
+
8
+ def defaults
9
+ {
10
+ src: "<p>custom html</p>",
11
+ css: nil
12
+ }
13
+ end
14
+ end
15
+
16
+ class LegacyRawHtml < V1
17
+ def identifier
18
+ "raw_html"
19
+ end
20
+
21
+ def defaults
22
+ {
23
+ src: "<p>custom html</p>",
24
+ css: nil
25
+ }
26
+ end
27
+
28
+ def render(&block)
29
+ super do
30
+ haml_tag :div, class: "iframe-container", style: style_string(options, :margin, :padding) do
31
+ haml_tag :iframe, src: options[:src], style: options[:css]
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,47 @@
1
+ module Maglove
2
+ module Widget
3
+ class ScrollableImage < V2
4
+ def identifier
5
+ "scrollable_image"
6
+ end
7
+
8
+ def defaults
9
+ {
10
+ source: false,
11
+ show_navigation: true,
12
+ height: "400px"
13
+ }
14
+ end
15
+ end
16
+
17
+ class LegacyScrollableImage < V1
18
+ def identifier
19
+ "scrollable_image"
20
+ end
21
+
22
+ def defaults
23
+ {
24
+ source: false,
25
+ show_navigation: true,
26
+ height: "400px",
27
+ margin_bottom: "0px"
28
+ }
29
+ end
30
+
31
+ def render(&block)
32
+ super do
33
+ haml_tag :div, class: "scrollable-image-container #{options[:show_navigation] ? 'show-navigation' : ''}", style: style_string(options, :margin, :padding, :height) do
34
+ haml_tag :div, class: "scrollable-image-inner" do
35
+ haml_tag :img, class: "scrollable-image", src: options[:source]
36
+ yield if block
37
+ end
38
+ if options[:show_navigation]
39
+ haml_tag :div, class: "scrollable-image-navigator scrollable-image-navigator-left"
40
+ haml_tag :div, class: "scrollable-image-navigator scrollable-image-navigator-right"
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,79 @@
1
+ module Maglove
2
+ module Widget
3
+ class Slider < V2
4
+ def identifier
5
+ "slider"
6
+ end
7
+
8
+ def defaults
9
+ {
10
+ slides: "3",
11
+ height: "auto",
12
+ background_color: "#EEEEEE",
13
+ buttons_position: "bottom",
14
+ autoplay: "true",
15
+ autoplay_timeout: "3000"
16
+ }
17
+ end
18
+
19
+ def slide(&block)
20
+ haml_tag :div, class: "slide" do
21
+ yield self if block_given?
22
+ end
23
+ end
24
+ end
25
+
26
+ class LegacySlider < V1
27
+ def identifier
28
+ "slider"
29
+ end
30
+
31
+ def defaults
32
+ {
33
+ slides: "3",
34
+ height: "auto",
35
+ margin_bottom: "0px",
36
+ background_color: "#EEEEEE",
37
+ buttons_position: "bottom",
38
+ autoplay: "true",
39
+ autoplay_timeout: "3000"
40
+ }
41
+ end
42
+
43
+ def render(&block)
44
+ super do
45
+ haml_tag :div, slider_options do
46
+ yield self if block_given?
47
+ end
48
+ end
49
+ end
50
+
51
+ def slide(&block)
52
+ haml_tag :div, class: "item" do
53
+ yield self if block_given?
54
+ drop_container
55
+ end
56
+ end
57
+
58
+ private
59
+
60
+ def slider_options
61
+ data = { class: slider_classes, autoplay: options[:autoplay], autoplay_timeout: options[:autoplay_timeout] }
62
+ { class: "owl-carousel", style: slider_styles, data: data }
63
+ end
64
+
65
+ def slider_styles
66
+ style_string options, :margin, :height, :background_color do |sb|
67
+ sb.add(:min_height, "120px")
68
+ sb.add(:overflow, "hidden")
69
+ end
70
+ end
71
+
72
+ def slider_classes
73
+ classes = ["owl-carousel", "owl-loaded", "owl-text-select-on", "owl-theme"]
74
+ classes.push("position-#{options[:buttons_position]}") unless options[:buttons_position].empty?
75
+ classes.join(" ")
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,54 @@
1
+ module Maglove
2
+ module Widget
3
+ class Video < V2
4
+ def identifier
5
+ "video"
6
+ end
7
+
8
+ def defaults
9
+ {
10
+ width: "640",
11
+ height: "360",
12
+ preload: "auto",
13
+ style: "default",
14
+ source: false,
15
+ poster: false,
16
+ autoplay: false,
17
+ controls: true,
18
+ loop: false
19
+ }
20
+ end
21
+ end
22
+
23
+ class LegacyVideo < V1
24
+ def identifier
25
+ "video"
26
+ end
27
+
28
+ def defaults
29
+ {
30
+ width: "640",
31
+ height: "360",
32
+ preload: "auto",
33
+ style: "default",
34
+ source: false,
35
+ poster: false,
36
+ autoplay: false,
37
+ controls: true,
38
+ loop: false,
39
+ margin_bottom: "0"
40
+ }
41
+ end
42
+
43
+ def render(&block)
44
+ super do
45
+ haml_tag :div, style: "margin-bottom: #{options[:margin_bottom]}", class: "video-widget player-style-#{options[:style]}" do
46
+ haml_tag :video, controls: true, poster: options[:poster], style: "width: 100%" do
47
+ haml_tag :source, src: options[:source].to_s, type: "video/mp4"
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,39 @@
1
+ module Maglove
2
+ module Widget
3
+ class Youtube < V2
4
+ def identifier
5
+ "youtube"
6
+ end
7
+
8
+ def defaults
9
+ {
10
+ youtube_id: "LFYNP40vfmE",
11
+ width: "800",
12
+ height: "600"
13
+ }
14
+ end
15
+ end
16
+
17
+ class LegacyYoutube < V1
18
+ def identifier
19
+ "youtube"
20
+ end
21
+
22
+ def defaults
23
+ {
24
+ youtube_id: "LFYNP40vfmE",
25
+ width: "800",
26
+ height: "600"
27
+ }
28
+ end
29
+
30
+ def render(&block)
31
+ super do
32
+ haml_tag :div, class: "flex-video widescreen", style: style_string(options, :margin, :padding) do
33
+ 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: ""
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,83 @@
1
+ module Maglove
2
+ module Widget
3
+ class Base
4
+ extend Forwardable
5
+ attr_reader :options, :scope
6
+ def_delegators :@scope, :haml_tag, :haml_concat
7
+
8
+ def identifier
9
+ "base"
10
+ end
11
+
12
+ def defaults
13
+ {}
14
+ end
15
+
16
+ def initialize(scope, options = {})
17
+ @options = defaults.merge(options)
18
+ @scope = scope
19
+ end
20
+
21
+ def widget_options
22
+ {}
23
+ end
24
+
25
+ def style_string(options, *args, &block)
26
+ scope.style_string(options, *args, &block)
27
+ end
28
+
29
+ def render(&block)
30
+ yield self if block_given?
31
+ end
32
+ end
33
+
34
+ class V2 < Base
35
+ def widget_options
36
+ attributes = { widget: true }
37
+ @options.each do |key, value|
38
+ attributes[key.to_s.dasherize.to_s] = value
39
+ end
40
+ if attributes["padding"]
41
+ attributes["padding"] = attributes["padding"].join(" ")
42
+ else
43
+ attributes["padding"] = "0 0 0 0"
44
+ end
45
+ attributes
46
+ end
47
+
48
+ def render(&block)
49
+ haml_tag "#{identifier}-widget", widget_options do
50
+ yield self if block_given?
51
+ end
52
+ end
53
+ end
54
+
55
+ class V1 < Base
56
+ def widget_options
57
+ attributes = {
58
+ :class => "_typeloft_widget",
59
+ :"data-widget-identifier" => identifier
60
+ }
61
+ @options.each do |k, v|
62
+ if [:padding, :margin].include?(k)
63
+ [:top, :right, :bottom, :left].each do |dir|
64
+ attributes["data-attribute-#{k}_#{dir}"] = v
65
+ end
66
+ end
67
+ attributes["data-attribute-#{k}"] = v
68
+ end
69
+ attributes
70
+ end
71
+
72
+ def render(&block)
73
+ haml_tag :div, widget_options do
74
+ yield self if block_given?
75
+ end
76
+ end
77
+
78
+ def drop_container
79
+ haml_tag :div, class: '_typeloft_widget_drop_container'
80
+ end
81
+ end
82
+ end
83
+ end
metadata ADDED
@@ -0,0 +1,183 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: maglove-engine
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.5
5
+ platform: ruby
6
+ authors:
7
+ - Tobias Strebitzer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-02-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: haml
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '6.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '4.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '6.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: activesupport
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '5.0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '5.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: nokogiri
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.8'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.8'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rspec
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.7'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '3.7'
75
+ - !ruby/object:Gem::Dependency
76
+ name: pry
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.11'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0.11'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0.52'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0.52'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rouge
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '3.1'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '3.1'
117
+ - !ruby/object:Gem::Dependency
118
+ name: htmlbeautifier
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1.3'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '1.3'
131
+ description: This gem contains development and built tools for rendering MagLoft themes.
132
+ email:
133
+ - tobias.strebitzer@magloft.com
134
+ executables: []
135
+ extensions: []
136
+ extra_rdoc_files: []
137
+ files:
138
+ - lib/maglove/engine.rb
139
+ - lib/maglove/engine/configuration.rb
140
+ - lib/maglove/engine/registry.rb
141
+ - lib/maglove/engine/scope.rb
142
+ - lib/maglove/engine/style_builder.rb
143
+ - lib/maglove/engine/version.rb
144
+ - lib/maglove/widget.rb
145
+ - lib/maglove/widget/button.rb
146
+ - lib/maglove/widget/columns.rb
147
+ - lib/maglove/widget/container.rb
148
+ - lib/maglove/widget/heading.rb
149
+ - lib/maglove/widget/horizontal_rule.rb
150
+ - lib/maglove/widget/image.rb
151
+ - lib/maglove/widget/listitem.rb
152
+ - lib/maglove/widget/page.rb
153
+ - lib/maglove/widget/paragraph.rb
154
+ - lib/maglove/widget/raw_html.rb
155
+ - lib/maglove/widget/scrollable_image.rb
156
+ - lib/maglove/widget/slider.rb
157
+ - lib/maglove/widget/video.rb
158
+ - lib/maglove/widget/youtube.rb
159
+ homepage: https://github.com/MagLoft/maglove
160
+ licenses:
161
+ - BSD-3-Clause
162
+ metadata: {}
163
+ post_install_message:
164
+ rdoc_options: []
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: 2.4.7
177
+ requirements: []
178
+ rubyforge_project:
179
+ rubygems_version: 2.6.10
180
+ signing_key:
181
+ specification_version: 4
182
+ summary: Maglove Engine - MagLoft Theme Rendering Engine.
183
+ test_files: []