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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4748abdec586703e35da282d7c702b29e5e48158356ac2d5aef4f0215ba164d
4
- data.tar.gz: cb3654c97538a02ea124d38990cb7b2d032ad43a05a9d3a1dc3854bfe594797b
3
+ metadata.gz: eaf0fa86c56cfc047f9e5b007c3d7a3e59ea692be4ad77e13b76b90484ea912a
4
+ data.tar.gz: dac7dada15d068e7027ffd08b691ba2c2d9cea35d991d446c9a9130da854dd6d
5
5
  SHA512:
6
- metadata.gz: 4a6c7c1aa263ad12cfacf7809b51e24723c2fe986c7e7c28aea56ae405fc59e8b3fa9abdd7cd56e6d6fe2abafea0d5c19d346aa6e1a1df05d949322ee8ead084
7
- data.tar.gz: ac6b95af83300094c21921a1e766389d45f6c38c1b1956817b92769ed399fc826043d215782b036cc3faf213e35475cde584c384d66a2e75163e3a0cdfa2add9
6
+ metadata.gz: 6b84143370687828d2bfbbda438b9db709d6e804a1b2e0b1ef24e3420ce40fe0c032ab286dafb7ae28645c58db5873c99e38a31722cc35f9811693812200ed37
7
+ data.tar.gz: 6df797e7f8f00da86d2f19147b0fc0fc7a840075f5230d724bf8929887f740d8dec6cbd357e51b7cd86fb58942491d88e7a276245c3a44c2c3489c8ae8b69521
@@ -5,11 +5,4 @@ module FXAwesomeMails
5
5
  ActiveSupport.on_load(:action_view) { include FXAwesomeMails::EmailHelpers }
6
6
  end
7
7
  end
8
- end
9
-
10
- # module FXAwesomeMails
11
- # module Rails
12
- # class Engine < ::Rails::Engine
13
- # end
14
- # end
15
- # end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module FXAwesomeMails
2
- VERSION = '0.6.3'
2
+ VERSION = '0.7.0'
3
3
  end
@@ -119,10 +119,11 @@ module FXAwesomeMails
119
119
  graphical_button(text, **options)
120
120
  end
121
121
  end
122
-
123
122
  end
124
- class Gutter
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', '&nbsp;'.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', '&nbsp;'.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', '&nbsp;'.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', '&nbsp;'.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: #FFFFFF;outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; display: block; border: none" }.merge_email_options(options)
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.vertical_grid(_capture_helper, **options, &block)
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(VerticalGrid.new(_capture_helper), &block)}
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 gutter(...)
196
- "<tr>#{Gutter.new(parent).horizontal(...)}</tr>".html_safe
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 horizontal_grid(**options, &block)
214
- "<tr>#{HorizontalGrid.horizontal_grid(parent, **options, &block)}</tr>".html_safe
215
+ def hstack(**options, &block)
216
+ "<tr>#{HStack.hstack(parent, **options, &block)}</tr>".html_safe
215
217
  end
216
218
 
217
- def vertical_grid(**options, &block)
218
- "<tr>#{VerticalGrid.vertical_grid(parent, **options, &block)}</tr>".html_safe
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 HorizontalGrid
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.horizontal_grid(_capture_helper, **options, &block)
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(HorizontalGrid.new(_capture_helper), &block)}
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 gutter(...)
244
- "#{Gutter.new(parent).vertical(...)}".html_safe
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 horizontal_grid(**options, &block)
276
- "#{HorizontalGrid.horizontal_grid(parent, **options, &block)}".html_safe
286
+ def hstack(**options, &block)
287
+ "#{HStack.hstack(parent, **options, &block)}".html_safe
277
288
  end
278
289
 
279
- def vertical_grid(**options, &block)
280
- "#{VerticalGrid.vertical_grid(parent, **options, &block)}".html_safe
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
- class ContentTable
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.content_table(_capture_helper, **options, &block)
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 gutter(...)
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
- #{Gutter.new(parent).horizontal(...)}
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 horizontal_grid(**options, &block)
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
- #{HorizontalGrid.horizontal_grid(parent, **options, &block)}
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 vertical_grid(**options, &block)
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
- #{VerticalGrid.vertical_grid(parent, **options, &block)}
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
- def content_table(**options, &block)
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.6.3
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: 2021-12-07 00:00:00.000000000 Z
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.1.6
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