fx_awesome_mails 0.6.3 → 0.7.0
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/lib/fx_awesome_mails/railtie.rb +1 -8
- data/lib/fx_awesome_mails/version.rb +1 -1
- data/lib/fx_awesome_mails/view_helpers.rb +67 -38
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eaf0fa86c56cfc047f9e5b007c3d7a3e59ea692be4ad77e13b76b90484ea912a
|
|
4
|
+
data.tar.gz: dac7dada15d068e7027ffd08b691ba2c2d9cea35d991d446c9a9130da854dd6d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6b84143370687828d2bfbbda438b9db709d6e804a1b2e0b1ef24e3420ce40fe0c032ab286dafb7ae28645c58db5873c99e38a31722cc35f9811693812200ed37
|
|
7
|
+
data.tar.gz: 6df797e7f8f00da86d2f19147b0fc0fc7a840075f5230d724bf8929887f740d8dec6cbd357e51b7cd86fb58942491d88e7a276245c3a44c2c3489c8ae8b69521
|
|
@@ -119,10 +119,11 @@ module FXAwesomeMails
|
|
|
119
119
|
graphical_button(text, **options)
|
|
120
120
|
end
|
|
121
121
|
end
|
|
122
|
-
|
|
123
122
|
end
|
|
124
|
-
|
|
123
|
+
|
|
124
|
+
class Spacer
|
|
125
125
|
attr_accessor :parent
|
|
126
|
+
|
|
126
127
|
def initialize(parent)
|
|
127
128
|
self.parent = parent
|
|
128
129
|
end
|
|
@@ -130,15 +131,17 @@ module FXAwesomeMails
|
|
|
130
131
|
|
|
131
132
|
def horizontal(height = '20', **options)
|
|
132
133
|
options = {valign: 'top', class: '',style: "text-align:left;font-size:1px;line-height:1px"}.merge_email_options(options)
|
|
133
|
-
content_tag('th', ' '.html_safe, height: height, valign: "#{options[:valign]}", style: "#{options[:style]}", class: "#{options[:class]} horizontal-gutter", bgcolor: options[:style].to_s.to_css_hash["background-color"].try(&:to_s))
|
|
134
|
+
content_tag('th', ' '.html_safe, height: height, valign: "#{options[:valign]}", style: "#{options[:style]}", class: "#{options[:class]} horizontal-spacer horizontal-gutter", bgcolor: options[:style].to_s.to_css_hash["background-color"].try(&:to_s))
|
|
134
135
|
end
|
|
135
136
|
|
|
136
137
|
def vertical(width = '20', **options)
|
|
137
138
|
options = {valign: 'top', class: '',style: "text-align:left;font-size:1px;line-height:1px"}.merge_email_options(options)
|
|
138
|
-
content_tag('th', ' '.html_safe, width: width, valign: "#{options[:valign]}", style: "#{options[:style]}", class: "#{options[:class]} vertical-gutter", bgcolor: options[:style].to_s.to_css_hash["background-color"].try(&:to_s))
|
|
139
|
+
content_tag('th', ' '.html_safe, width: width, valign: "#{options[:valign]}", style: "#{options[:style]}", class: "#{options[:class]} vertical-spacer vertical-gutter", bgcolor: options[:style].to_s.to_css_hash["background-color"].try(&:to_s))
|
|
139
140
|
end
|
|
140
141
|
end
|
|
141
142
|
|
|
143
|
+
Gutter = Spacer
|
|
144
|
+
|
|
142
145
|
class Text
|
|
143
146
|
attr_accessor :parent
|
|
144
147
|
def initialize(parent)
|
|
@@ -162,7 +165,7 @@ module FXAwesomeMails
|
|
|
162
165
|
delegate :capture, :content_tag, :link_to, :link_to_if, :link_to_if_true, :image_tag, :to => :parent
|
|
163
166
|
|
|
164
167
|
def email_image_tag(source: nil, **options, &block)
|
|
165
|
-
options = {alt: '', link_url: nil, width: 130, height: 50, valign: 'top', align: 'left', class: '', style: "background-color:
|
|
168
|
+
options = {alt: '', link_url: nil, width: 130, height: 50, valign: 'top', align: 'left', class: '', style: "background-color: transparent;outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; display: block; border: none" }.merge_email_options(options)
|
|
166
169
|
html = "<th valign='#{options[:valign]}' style='text-align:#{options[:align]}' class='#{options[:class]} image-container' bgcolor='#{options[:style].to_s.to_css_hash["background-color"]}' align='#{options[:align]}'>"
|
|
167
170
|
html << link_to_if_true(options[:link_url].present?, options[:link_url], target: '_blank') do
|
|
168
171
|
image_tag(source, style: options[:style], width: "#{options[:width]}", height: "#{options[:height]}", alt: "#{options[:alt]}")
|
|
@@ -173,27 +176,26 @@ module FXAwesomeMails
|
|
|
173
176
|
end
|
|
174
177
|
end
|
|
175
178
|
|
|
176
|
-
|
|
177
|
-
class VerticalGrid
|
|
179
|
+
class VStack
|
|
178
180
|
attr_accessor :parent
|
|
179
181
|
def initialize(parent)
|
|
180
182
|
self.parent = parent
|
|
181
183
|
end
|
|
182
184
|
delegate :capture, :content_tag, :link_to, :link_to_if, :link_to_if_true, :image_tag, :to => :parent
|
|
183
185
|
|
|
184
|
-
def self.
|
|
186
|
+
def self.vstack(_capture_helper, **options, &block)
|
|
185
187
|
options = { valign: 'top', style: "text-align: left" }.merge_email_options(options)
|
|
186
|
-
_capture_helper.content_tag('th', valign: "#{options[:valign]}", style: "#{options[:style]}", class: "vertical-grid #{options[:class]}") do
|
|
188
|
+
_capture_helper.content_tag('th', valign: "#{options[:valign]}", style: "#{options[:style]}", class: "vertical-stack vertical-grid #{options[:class]}") do
|
|
187
189
|
"<table cellpadding='0' cellspacing='0' border='0' width='100%' style='min-width:100%' role='presentation'>
|
|
188
190
|
<tbody>
|
|
189
|
-
#{_capture_helper.capture(
|
|
191
|
+
#{_capture_helper.capture(VStack.new(_capture_helper), &block)}
|
|
190
192
|
</tbody>
|
|
191
193
|
</table>".html_safe
|
|
192
194
|
end
|
|
193
195
|
end
|
|
194
196
|
|
|
195
|
-
def
|
|
196
|
-
"<tr>#{
|
|
197
|
+
def spacer(...)
|
|
198
|
+
"<tr>#{Spacer.new(parent).horizontal(...)}</tr>".html_safe
|
|
197
199
|
end
|
|
198
200
|
|
|
199
201
|
def text(text = nil, **options, &block)
|
|
@@ -210,38 +212,47 @@ module FXAwesomeMails
|
|
|
210
212
|
</tr>".html_safe
|
|
211
213
|
end
|
|
212
214
|
|
|
213
|
-
def
|
|
214
|
-
"<tr>#{
|
|
215
|
+
def hstack(**options, &block)
|
|
216
|
+
"<tr>#{HStack.hstack(parent, **options, &block)}</tr>".html_safe
|
|
215
217
|
end
|
|
216
218
|
|
|
217
|
-
def
|
|
218
|
-
"<tr>#{
|
|
219
|
+
def vstack(**options, &block)
|
|
220
|
+
"<tr>#{VStack.vstack(parent, **options, &block)}</tr>".html_safe
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
alias_method :horizontal_grid, :hstack
|
|
224
|
+
alias_method :vertical_grid, :vstack
|
|
225
|
+
alias_method :gutter, :spacer
|
|
226
|
+
|
|
227
|
+
class <<self
|
|
228
|
+
alias_method :vertical_grid, :vstack
|
|
219
229
|
end
|
|
220
230
|
end
|
|
221
231
|
|
|
232
|
+
VerticalGrid = VStack
|
|
222
233
|
|
|
223
|
-
class
|
|
234
|
+
class HStack
|
|
224
235
|
attr_accessor :parent
|
|
225
236
|
def initialize(parent)
|
|
226
237
|
self.parent = parent
|
|
227
238
|
end
|
|
228
239
|
delegate :capture, :content_tag, :link_to, :link_to_if, :link_to_if_true, :image_tag, :to => :parent
|
|
229
240
|
|
|
230
|
-
def self.
|
|
241
|
+
def self.hstack(_capture_helper, **options, &block)
|
|
231
242
|
options = { valign: 'top', style: "text-align: left" }.merge_email_options(options)
|
|
232
|
-
"<th valign='#{options[:valign]}' style='#{options[:style]}' class='#{options[:class]} horizontal-grid'>
|
|
243
|
+
"<th valign='#{options[:valign]}' style='#{options[:style]}' class='#{options[:class]} horizontal-stack horizontal-grid'>
|
|
233
244
|
<table cellpadding='0' cellspacing='0' border='0' width='100%' style='min-width:100%' role='presentation'>
|
|
234
245
|
<tbody>
|
|
235
246
|
<tr>
|
|
236
|
-
#{_capture_helper.capture(
|
|
247
|
+
#{_capture_helper.capture(HStack.new(_capture_helper), &block)}
|
|
237
248
|
</tr>
|
|
238
249
|
</tbody>
|
|
239
250
|
</table>
|
|
240
251
|
</th>".html_safe
|
|
241
252
|
end
|
|
242
253
|
|
|
243
|
-
def
|
|
244
|
-
"#{
|
|
254
|
+
def spacer(...)
|
|
255
|
+
"#{Spacer.new(parent).vertical(...)}".html_safe
|
|
245
256
|
end
|
|
246
257
|
|
|
247
258
|
def text(...)
|
|
@@ -272,25 +283,33 @@ module FXAwesomeMails
|
|
|
272
283
|
</th>".hmtl_safe
|
|
273
284
|
end
|
|
274
285
|
|
|
275
|
-
def
|
|
276
|
-
"#{
|
|
286
|
+
def hstack(**options, &block)
|
|
287
|
+
"#{HStack.hstack(parent, **options, &block)}".html_safe
|
|
277
288
|
end
|
|
278
289
|
|
|
279
|
-
def
|
|
280
|
-
"#{
|
|
290
|
+
def vstack(**options, &block)
|
|
291
|
+
"#{VStack.vstack(parent, **options, &block)}".html_safe
|
|
281
292
|
end
|
|
282
293
|
|
|
294
|
+
alias_method :horizontal_grid, :hstack
|
|
295
|
+
alias_method :vertical_grid, :vstack
|
|
296
|
+
alias_method :gutter, :spacer
|
|
297
|
+
|
|
298
|
+
class <<self
|
|
299
|
+
alias_method :horizontal_grid, :hstack
|
|
300
|
+
end
|
|
283
301
|
end
|
|
284
302
|
|
|
285
|
-
|
|
286
|
-
|
|
303
|
+
HorizontalGrid = HStack
|
|
304
|
+
|
|
305
|
+
class EmailContent
|
|
287
306
|
attr_accessor :parent
|
|
288
307
|
def initialize(parent)
|
|
289
308
|
self.parent = parent
|
|
290
309
|
end
|
|
291
310
|
delegate :capture, :content_tag, :link_to, :link_to_if, :link_to_if_true, :image_tag, :to => :parent
|
|
292
311
|
|
|
293
|
-
def self.
|
|
312
|
+
def self.email_content(_capture_helper, **options, &block)
|
|
294
313
|
options = {alt: '', link_url: nil, width: 600, height: 50, valign: 'top', align: 'left', class: '', background: '', style: "background-color: #FFFFFF" }.merge_email_options(options)
|
|
295
314
|
"<table cellpadding='0' cellspacing='0' border='0' width='#{options[:width]}' style='margin: 0; padding: 0; text-align: left; width: 100%; min-width: 600px; line-height: 100%;' role='presentation' background='#{options[:background]}' class='background-table has-width-#{options[:width]}' bgcolor='#{options[:style].to_s.to_css_hash["background-color"]}' valign='top'>
|
|
296
315
|
<tbody>
|
|
@@ -367,37 +386,37 @@ module FXAwesomeMails
|
|
|
367
386
|
</div>".html_safe
|
|
368
387
|
end
|
|
369
388
|
|
|
370
|
-
def
|
|
389
|
+
def spacer(...)
|
|
371
390
|
# only horizontal
|
|
372
391
|
"<div>
|
|
373
392
|
<table cellpadding='0' cellspacing='0' border='0' width='100%' style='min-width:100%' role='presentation'>
|
|
374
393
|
<tbody>
|
|
375
394
|
<tr>
|
|
376
|
-
#{
|
|
395
|
+
#{Spacer.new(parent).horizontal(...)}
|
|
377
396
|
</tr>
|
|
378
397
|
</tbody>
|
|
379
398
|
</table>
|
|
380
399
|
</div>".html_safe
|
|
381
400
|
end
|
|
382
401
|
|
|
383
|
-
def
|
|
402
|
+
def hstack(**options, &block)
|
|
384
403
|
"<div>
|
|
385
404
|
<table cellpadding='0' cellspacing='0' border='0' width='100%' style='min-width:100%' role='presentation'>
|
|
386
405
|
<tbody>
|
|
387
406
|
<tr>
|
|
388
|
-
#{
|
|
407
|
+
#{HStack.hstack(parent, **options, &block)}
|
|
389
408
|
</tr>
|
|
390
409
|
</tbody>
|
|
391
410
|
</table>
|
|
392
411
|
</div>".html_safe
|
|
393
412
|
end
|
|
394
413
|
|
|
395
|
-
def
|
|
414
|
+
def vstack(**options, &block)
|
|
396
415
|
"<div>
|
|
397
416
|
<table cellpadding='0' cellspacing='0' border='0' width='100%' style='min-width:100%' role='presentation'>
|
|
398
417
|
<tbody>
|
|
399
418
|
<tr>
|
|
400
|
-
#{
|
|
419
|
+
#{VStack.vstack(parent, **options, &block)}
|
|
401
420
|
</tr>
|
|
402
421
|
</tbody>
|
|
403
422
|
</table>
|
|
@@ -415,11 +434,21 @@ module FXAwesomeMails
|
|
|
415
434
|
# </table>
|
|
416
435
|
# </div>".html_safe
|
|
417
436
|
# end
|
|
418
|
-
|
|
437
|
+
alias_method :horizontal_grid, :hstack
|
|
438
|
+
alias_method :vertical_grid, :vstack
|
|
439
|
+
alias_method :gutter, :spacer
|
|
440
|
+
|
|
441
|
+
class <<self
|
|
442
|
+
alias_method :content_table, :email_content
|
|
443
|
+
end
|
|
419
444
|
end
|
|
420
|
-
|
|
421
|
-
|
|
445
|
+
|
|
446
|
+
ContentTable = EmailContent
|
|
447
|
+
|
|
448
|
+
def email_content(**options, &block)
|
|
422
449
|
ContentTable.content_table(self, **options, &block)
|
|
423
450
|
end
|
|
451
|
+
|
|
452
|
+
alias_method :content_table, :email_content
|
|
424
453
|
end
|
|
425
454
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fx_awesome_mails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Felix Gebhard
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-09-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
62
|
version: '0'
|
|
63
63
|
requirements: []
|
|
64
|
-
rubygems_version: 3.
|
|
64
|
+
rubygems_version: 3.3.3
|
|
65
65
|
signing_key:
|
|
66
66
|
specification_version: 4
|
|
67
67
|
summary: Provides various view helpers for cross client mail creation
|