rails_email_preview 0.2.13 → 0.2.14

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: b44a4b280e5291dc798bfeb120c17818d0dd2e37
4
- data.tar.gz: 0f855925b97c9f6be33ddb0d25ca2953b1ca1793
3
+ metadata.gz: 470b4acb87f3f09970b99c473dc2513e4e7b4cd7
4
+ data.tar.gz: 1a408bcd46fb2917eb812098a1d5da1d0c2e0498
5
5
  SHA512:
6
- metadata.gz: e0fa37f8f6df335c3da58b8e1c5e503f07ba4ceb4ca3d99f92805937954eea5d0af0d9ab7ec42aa0622380a60e0ce2406eec687d9051d468bef229c6b4265763
7
- data.tar.gz: d1b2994ead7dc9bc522a0b1a36e4f0a6c639d280117afb3ed1131efb08f29f8e40d64e88a2ac0974838a308296bfd7cdf4c1eeda0bb6929fe444d3534e391feb
6
+ metadata.gz: 535c2d3ea7abdab5ce70e4031354958ebf1eab6788676215cce6642b875e5871cb6bef12343674a010db05e48b43a0038a93ae8bbb27321de97377626a5bd419
7
+ data.tar.gz: 2b8825c44c05aaa3dbf24fc82e2d7d42cbcf5cd7ba3c52f654a4afbf0165e9d7877652342483d77d9574528fc04dc25234499e9566935a5d276a2089f4e457fd
@@ -4,18 +4,22 @@ ruby:
4
4
  if snippet && (p = ::RailsEmailPreview::Integrations::ComfortableMexicanSofa.rep_email_params_from_snippet(snippet))
5
5
  show_url = rails_email_preview.rep_raw_email_url(p.merge part_type: 'text/html')
6
6
  end
7
+ customize_form = show_url.present? || snippet && !snippet.persisted?
7
8
 
8
- - if show_url.present?
9
+ - if customize_form
9
10
  javascript:
10
11
  jQuery(function($) {
11
12
  if (window.parent && (new RegExp('#{rails_email_preview.rep_root_path}')).test(parent.location.href)) {
12
13
  // Hide nav:
13
14
  $('.left-column,.right-column').hide();
14
15
  $('.center-column').css('margin', 0);
15
- $('.page-header h2').html(
16
- "#{t '.edit_email'}" +
17
- " <a class='btn btn-primary' href='#{show_url}'>#{t '.view_link'}</a>"
18
- )
16
+
17
+ var showUrl = '#{show_url}';
18
+
19
+ if (showUrl) {
20
+ $('.page-header h2').html(
21
+ "#{t '.edit_email'}" + " <a class='btn btn-primary' href='" + showUrl + "'>#{t '.view_link'}</a>");
22
+ }
19
23
 
20
24
  // Snippet form:
21
25
  var control = function(name) { return $('[name^="snippet[' + name + ']"]').closest('.control-group'); };
@@ -6,18 +6,19 @@
6
6
  li.active: a href=(request.url) = current_email_name
7
7
 
8
8
  div class=rep_style[:panel_class]
9
- div class=rep_style[:row_class]
10
- -# From, To, Subject and other headers
11
- div class=rep_col_class(8)
12
- = render 'rails_email_preview/emails/headers'
13
- -# Locale, format and actions
14
- div class=rep_col_class(4)
15
- ul.list-unstyled.text-right.rep-email-options
16
- - if I18n.available_locales.length > 1
17
- li= render 'rails_email_preview/emails/i18n_nav'
18
- - if RailsEmailPreview.enable_send_email
19
- li= render 'rails_email_preview/emails/send_form'
20
- li= render 'rails_email_preview/emails/format_nav'
9
+ div class=rep_style[:panel_body_class]
10
+ div class=rep_style[:row_class]
11
+ -# From, To, Subject and other headers
12
+ div class=rep_col_class(8)
13
+ = render 'rails_email_preview/emails/headers'
14
+ -# Locale, format and actions
15
+ div class=rep_col_class(4)
16
+ ul.list-unstyled.text-right.rep-email-options
17
+ - if I18n.available_locales.length > 1
18
+ li= render 'rails_email_preview/emails/i18n_nav'
19
+ - if RailsEmailPreview.enable_send_email
20
+ li= render 'rails_email_preview/emails/send_form'
21
+ li= render 'rails_email_preview/emails/format_nav'
21
22
 
22
23
  -# actual email content, rendered in an iframe to prevent browser styles from interfering
23
24
  .margin-right
@@ -29,5 +29,6 @@ de:
29
29
  send_recipient_placeholder: "E-Mails"
30
30
  integrations:
31
31
  cms:
32
- edit_email: "E-Mail bearbeiten"
33
- view_link: "Anzeigen"
32
+ customize_cms_for_rails_email_preview:
33
+ edit_email: "E-Mail bearbeiten"
34
+ view_link: "Anzeigen"
@@ -29,5 +29,6 @@ en:
29
29
  send_recipient_placeholder: "Email"
30
30
  integrations:
31
31
  cms:
32
- edit_email: "Editing email"
33
- view_link: "View"
32
+ customize_cms_for_rails_email_preview:
33
+ edit_email: "Editing email"
34
+ view_link: "View"
@@ -61,20 +61,22 @@ module RailsEmailPreview
61
61
  if cms_email_edit_link?
62
62
  snippet = site.snippets.find_by_identifier(snippet_id)
63
63
 
64
+ route_name = respond_to?(:new_cms_admin_site_snippet_path) ? :cms_admin_site_snippet : :admin_cms_site_snippet
65
+
64
66
 
65
67
  cms_path = if snippet
66
68
  unless content
67
69
  fallback_snippet = default_site.snippets.find_by_identifier(snippet_id)
68
70
  prefill_from_default = {label: fallback_snippet.label, content: fallback_snippet.content}
69
71
  end
70
- edit_cms_admin_site_snippet_path(site_id: site.id, id: snippet.id,
71
- snippet: prefill_from_default || nil)
72
+ send :"edit_#{route_name}_path", site_id: site.id, id: snippet.id, snippet: prefill_from_default || nil
72
73
  else
73
- new_cms_admin_site_snippet_path(site_id: site.id, snippet: {
74
- label: "#{snippet_id.sub('-', ' / ').humanize}",
75
- identifier: snippet_id,
76
- category_ids: [site.categories.find_by_label('email').try(:id)]
77
- })
74
+ send :"new_#{route_name}_path", site_id: site.id,
75
+ snippet: {
76
+ label: "#{snippet_id.sub('-', ' / ').humanize}",
77
+ identifier: snippet_id,
78
+ category_ids: [site.categories.find_by_label('email').try(:id)]
79
+ }
78
80
  end
79
81
 
80
82
  result = safe_join ["<table class='rep-edit-link'><tr><td>".html_safe, cms_edit_email_snippet_link(cms_path),
@@ -106,4 +108,4 @@ ActionMailer::Base.module_eval do
106
108
  end
107
109
 
108
110
  require 'comfortable_mexican_sofa'
109
- ComfortableMexicanSofa::ViewHooks.add :header, 'integrations/cms/customize_cms_for_rails_email_preview'
111
+ ComfortableMexicanSofa::ViewHooks.add :navigation, 'integrations/cms/customize_cms_for_rails_email_preview'
@@ -1,3 +1,3 @@
1
1
  module RailsEmailPreview
2
- VERSION = '0.2.13'
2
+ VERSION = '0.2.14'
3
3
  end
@@ -32,6 +32,7 @@ module RailsEmailPreview
32
32
  list_group_class: 'list-group',
33
33
  list_group_item_class: 'list-group-item',
34
34
  panel_class: 'panel panel-default',
35
+ panel_body_class: 'panel-body',
35
36
  row_class: 'row',
36
37
  column_class: 'col-sm-%{n}'
37
38
  }
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.2.13
4
+ version: 0.2.14
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-11-18 00:00:00.000000000 Z
11
+ date: 2013-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails