rails_email_preview 0.1.4 → 0.1.5

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: c41664587bd742c38c9a7412789e50ee8dd25f9f
4
- data.tar.gz: 9233b03db2d77565532671356eeedad7880bf367
3
+ metadata.gz: aa7d4eb9873fb41236d985af8f4d4944a6aa7056
4
+ data.tar.gz: a2b36c22f1f76369e2f400fecda49383fa1f0dfa
5
5
  SHA512:
6
- metadata.gz: b5c7326e71cf687b6ee61bfd1471c1c2e231787b16cb881b946fee13d78c85c9eccbc2425a68916fc624efcde62206bd95f1aa8647ecf13263b2b58ce1d358f8
7
- data.tar.gz: 279f405af4ede083776ed9fab92c534b73f790e7db0559c128a87b61fc69c982a6af39415771710ce7301e4900683450b819c761dc29bab6414ae23a1623ac30
6
+ metadata.gz: 67f0eb7c5cb4ad07bd3f991aa0cc8c000a67d56982c140cc46a70a5674e75aa125096d6ac1ee376a8d00d1923bfd20ca0aad4e1724b71a1efff8ccaf8fce2b3f
7
+ data.tar.gz: af01ce4227f49d190fb846a1152e5ecf611b69397b0fa1d40eedfb5c7727bbced5d741cec44e951ab872c5ed211a4a198bf9e6a994cfa3f9b4d0d06b49cb4ba7
data/README.md CHANGED
@@ -44,7 +44,7 @@ You will need to provide data for preview of each email:
44
44
  # Let REP know about UserMailerPreview:
45
45
  # touch config/initializers/rails_email_preview.rb
46
46
  RailsEmailPreview.setup do |config|
47
- config.preview_classes = [ UserMailerPreview ]
47
+ config.preview_classes = %w( UserMailerPreview )
48
48
  end
49
49
 
50
50
 
@@ -0,0 +1,9 @@
1
+ module RailsEmailPreview::EmailsHelper
2
+ def format_header(value)
3
+ if value.is_a?(Array)
4
+ value.map(&:to_s) * ', '
5
+ else
6
+ value.to_s
7
+ end
8
+ end
9
+ end
@@ -7,13 +7,15 @@ javascript:
7
7
  $('.center-column').css('margin', 0);
8
8
 
9
9
  // Snippet form:
10
+ var control = function(name) { return $('[name="snippet[' + name + ']"]').closest('.control-group'); };
11
+
12
+ control('label').find('.control-label').text("Subject");
13
+ control('content').find('.control-label').text("Body");
14
+
10
15
  // Hide identifier and categories
11
- $('[name="snippet[identifier]"]').closest('.control-group').hide();
16
+ control('identifier').hide();
12
17
  $('label[for="snippet_"]').closest('.control-group').hide();
13
- // Label to Subject
14
- $('[name="snippet[label]"]').closest('.control-group').find('.control-label').text("Subject");
15
- // Content to Body
16
- $('[name="snippet[content]"]').closest('.control-group').find('.control-label').text("Body");
18
+
17
19
  // Do not mess with identifier
18
20
  $('[data-slug]').removeAttr('data-slug');
19
21
  }
@@ -1,4 +1,15 @@
1
+ ruby:
2
+ headers = {
3
+ 'From' => @mail.from,
4
+ 'To' => @mail.to,
5
+ 'CC' => @mail.cc,
6
+ 'BCC' => @mail.bcc,
7
+ 'Subject' => @mail.subject || '(no subject)'
8
+ }.delete_if { |k, v| v.blank? }
9
+
10
+
11
+
1
12
  dl
2
- - { 'From' => @mail.from * ', ', 'To' => @mail.to * ', ', 'Subject' => @mail.subject}.each do |header, value|
13
+ - headers.each do |header, value|
3
14
  dt #{header}
4
- dd #{value}
15
+ dd #{format_header(value)}
@@ -25,12 +25,13 @@ module RailsEmailPreview
25
25
  self.edit_link_text = '✎ Edit Text'
26
26
  mattr_accessor :edit_link_style
27
27
  self.edit_link_style = <<-CSS.strip.gsub(/\n+/m, ' ')
28
- display: block;
29
- font-family: "Monaco", "Helvetica", sans-serif;
30
- color: #7a4b8a;
31
- border: 2px dashed #7a4b8a;
32
- font-size: 20px;
33
- padding: 8px 12px;
34
- margin-top: 1em;
28
+ display: block;
29
+ font-family: Monaco, Helvetica, sans-serif;
30
+ color: #7a4b8a;
31
+ border: 2px dashed #7a4b8a;
32
+ font-size: 20px;
33
+ padding: 8px 12px;
34
+ margin-top: 0.6em;
35
+ margin-bottom: 0.6em;
35
36
  CSS
36
37
  end
@@ -67,13 +67,17 @@ module RailsEmailPreview
67
67
  })
68
68
  end
69
69
 
70
- result += "\n\n" + cms_edit_email_snippet_link(cms_path)
70
+ result = safe_join [result, "\n\n",
71
+ "<table><tr><td>".html_safe,
72
+ cms_edit_email_snippet_link(cms_path),
73
+ "</td></tr></table>".html_safe,
74
+ "\n"]
71
75
  end
72
76
  result
73
77
  end
74
78
 
75
79
  def cms_edit_email_snippet_link(path)
76
- link_to(RailsEmailPreview.edit_link_text, path, style: RailsEmailPreview.edit_link_style, 'onClick' => '')
80
+ link_to(RailsEmailPreview.edit_link_text, path, style: RailsEmailPreview.edit_link_style.html_safe, 'onClick' => '')
77
81
  end
78
82
  end
79
83
  end
@@ -1,3 +1,3 @@
1
1
  module RailsEmailPreview
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_email_preview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Mazovetskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-11 00:00:00.000000000 Z
11
+ date: 2013-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -77,6 +77,7 @@ files:
77
77
  - app/assets/stylesheets/rails_email_preview/application.css.sass
78
78
  - app/controllers/rails_email_preview/application_controller.rb
79
79
  - app/controllers/rails_email_preview/emails_controller.rb
80
+ - app/helpers/rails_email_preview/emails_helper.rb
80
81
  - app/views/integrations/cms/_customize_cms_for_rails_email_preview.html.slim
81
82
  - app/views/layouts/rails_email_preview/application.html.slim
82
83
  - app/views/rails_email_preview/emails/_email_iframe.html.slim