channel_research_stationery 2.10.1 → 2.10.2
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/channel_research_stationery.rb +38 -20
- data/lib/generators/templates/content_styles.sass +18 -0
- data/lib/generators/templates/template.html.haml +1 -1
- data/lib/generators/templates/{styles.sass → template_styles.sass} +0 -9
- metadata +3 -3
- data/lib/generators/templates/layout.html.erb +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 150977a0f49b4808ab1cdfe96c888dd38e588db0
|
|
4
|
+
data.tar.gz: 7ec3a658cd2a7886b1387550d89795d7b45a0459
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f3cb0d100f5fa519a881e7ab195b4308b3675c8a2dfc4756714a0860a82bac7064528ad8f620d574ca9009697817b65ddca72df220cd87403702b1954a0ae53
|
|
7
|
+
data.tar.gz: 93fadde69def9e9cd2e5ea25558f682777b2acce53b0f3096f9c62aa5c6c8e963544cc466f345e9d5fd2c85d7d442d22f00b05cad6655cbfc8d6ea0593f07a32
|
|
@@ -19,31 +19,36 @@ class ChannelResearchStationery
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def to_html
|
|
22
|
-
|
|
23
|
-
layout_path = File.join( __dir__, "./generators/templates/layout.html.erb" )
|
|
24
|
-
contents = File.open(layout_path, "rb").read
|
|
25
|
-
ERB.new(contents).result( binding )
|
|
22
|
+
template_and_content
|
|
26
23
|
end
|
|
27
24
|
|
|
28
|
-
def
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
doc = Nokogiri::HTML(template_with_inline_css)
|
|
34
|
-
doc.at('div#main_content') << @content
|
|
25
|
+
def template_and_content
|
|
26
|
+
template = Nokogiri::HTML(template_with_inline_css)
|
|
27
|
+
content = Nokogiri::HTML(content_with_inline_css)
|
|
28
|
+
template.at('style').remove
|
|
29
|
+
template.at('div#content') << content.at('body')
|
|
35
30
|
# Add content-editable bits
|
|
36
|
-
|
|
31
|
+
template.xpath('//*[@class="contenteditable"]').each do |node|
|
|
37
32
|
node['contenteditable'] = 'true'
|
|
38
33
|
end
|
|
39
|
-
return
|
|
34
|
+
return template
|
|
40
35
|
end
|
|
41
36
|
|
|
42
37
|
def template_with_inline_css
|
|
43
38
|
Premailer.new(template,
|
|
44
39
|
{
|
|
45
40
|
warn_level: Premailer::Warnings::SAFE,
|
|
46
|
-
css_string:
|
|
41
|
+
css_string: template_css_string,
|
|
42
|
+
with_html_string: true
|
|
43
|
+
}
|
|
44
|
+
).to_inline_css
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def content_with_inline_css
|
|
48
|
+
Premailer.new(@content,
|
|
49
|
+
{
|
|
50
|
+
warn_level: Premailer::Warnings::SAFE,
|
|
51
|
+
css_string: content_css_string,
|
|
47
52
|
with_html_string: true
|
|
48
53
|
}
|
|
49
54
|
).to_inline_css
|
|
@@ -61,8 +66,12 @@ class ChannelResearchStationery
|
|
|
61
66
|
engine.render(Object.new, { options: @options })
|
|
62
67
|
end
|
|
63
68
|
|
|
64
|
-
def
|
|
65
|
-
reset_css +
|
|
69
|
+
def template_css_string
|
|
70
|
+
reset_css + template_styles_css
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def content_css_string
|
|
74
|
+
reset_css + content_styles_css + @options[:extra_css]
|
|
66
75
|
end
|
|
67
76
|
|
|
68
77
|
def reset_css
|
|
@@ -71,20 +80,28 @@ class ChannelResearchStationery
|
|
|
71
80
|
end
|
|
72
81
|
|
|
73
82
|
def sass_options
|
|
74
|
-
@options.select {|k,v| [:background_color,:header_background_color,:width].include?(k)}
|
|
83
|
+
@options.select {|k,v| [:background_color,:header_background_color,:width,:cta_background_color,:cta_color,:bold_color,:link_color].include?(k)}
|
|
75
84
|
end
|
|
76
85
|
|
|
77
86
|
def sass_variables
|
|
78
87
|
sass_options.map {|k,v| "$#{k}: #{v};"}.join("\n")
|
|
79
88
|
end
|
|
80
89
|
|
|
81
|
-
def
|
|
82
|
-
css_path = File.join( __dir__, "./generators/templates/
|
|
90
|
+
def template_styles_css
|
|
91
|
+
css_path = File.join( __dir__, "./generators/templates/template_styles.sass" )
|
|
92
|
+
sass_styles = File.open(css_path, "rb").read
|
|
93
|
+
sass = sass_variables + "\n" + sass_styles
|
|
94
|
+
SassC::Engine.new(sass, style: :compressed).render
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def content_styles_css
|
|
98
|
+
css_path = File.join( __dir__, "./generators/templates/content_styles.sass" )
|
|
83
99
|
sass_styles = File.open(css_path, "rb").read
|
|
84
100
|
sass = sass_variables + "\n" + sass_styles
|
|
85
101
|
SassC::Engine.new(sass, style: :compressed).render
|
|
86
102
|
end
|
|
87
103
|
|
|
104
|
+
|
|
88
105
|
def default_options
|
|
89
106
|
{
|
|
90
107
|
header_background_color: @primary_color,
|
|
@@ -97,7 +114,8 @@ class ChannelResearchStationery
|
|
|
97
114
|
badge_left: false,
|
|
98
115
|
badge_right: false,
|
|
99
116
|
title: false,
|
|
100
|
-
subtitle: false
|
|
117
|
+
subtitle: false,
|
|
118
|
+
extra_css: ''
|
|
101
119
|
}
|
|
102
120
|
end
|
|
103
121
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
* {
|
|
2
|
+
font-size:13px;
|
|
3
|
+
font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
|
|
4
|
+
letter-spacing: -1px;
|
|
5
|
+
color: #666666;
|
|
6
|
+
line-height: 19px;
|
|
7
|
+
-webkit-text-size-adjust: none;
|
|
8
|
+
-webkit-font-smoothing: antialiased;
|
|
9
|
+
}
|
|
10
|
+
a {color:$link_color;}
|
|
11
|
+
strong, b {color:$bold_color;}
|
|
12
|
+
img {max-width:100%;}
|
|
13
|
+
p.call_to_action a {color: $cta_color; background-color: $cta_background_color;}
|
|
14
|
+
table {width:100%;}
|
|
15
|
+
table tr {vertical-align: top;}
|
|
16
|
+
table td,th {font-size:13px; padding:5px; color:#666666;}
|
|
17
|
+
table th {text-align: center; font-weight:bold;}
|
|
18
|
+
//<%= @options[:extra_css] %>
|
|
@@ -56,15 +56,6 @@ table.email-body-wrap {
|
|
|
56
56
|
padding-bottom:36px;
|
|
57
57
|
color: #666666;
|
|
58
58
|
}
|
|
59
|
-
#main_content {
|
|
60
|
-
font-size:13px;
|
|
61
|
-
font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
|
|
62
|
-
letter-spacing: -1px;
|
|
63
|
-
color: #666666;
|
|
64
|
-
line-height: 19px;
|
|
65
|
-
-webkit-text-size-adjust: none;
|
|
66
|
-
-webkit-font-smoothing: antialiased;
|
|
67
|
-
}
|
|
68
59
|
}
|
|
69
60
|
tr#footer td {
|
|
70
61
|
color: #666666;
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: channel_research_stationery
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.10.
|
|
4
|
+
version: 2.10.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Channel Research Team
|
|
@@ -73,10 +73,10 @@ extensions: []
|
|
|
73
73
|
extra_rdoc_files: []
|
|
74
74
|
files:
|
|
75
75
|
- lib/channel_research_stationery.rb
|
|
76
|
-
- lib/generators/templates/
|
|
76
|
+
- lib/generators/templates/content_styles.sass
|
|
77
77
|
- lib/generators/templates/reset.css
|
|
78
|
-
- lib/generators/templates/styles.sass
|
|
79
78
|
- lib/generators/templates/template.html.haml
|
|
79
|
+
- lib/generators/templates/template_styles.sass
|
|
80
80
|
homepage: https://www.brandnewbox.com
|
|
81
81
|
licenses:
|
|
82
82
|
- MIT
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<html>
|
|
2
|
-
<head>
|
|
3
|
-
<title>Channel Research Team</title>
|
|
4
|
-
<link href='https://wwcci-email-assets.s3.amazonaws.com/bnb/css/myriad-set-pro.css' rel='stylesheet' type='text/css' />
|
|
5
|
-
<style>
|
|
6
|
-
#main_content a {color:<%= @options[:link_color] %>;}
|
|
7
|
-
#main_content strong, #main_content b {color:<%= @options[:bold_color] %>;}
|
|
8
|
-
#main_content img {max-width:100%;}
|
|
9
|
-
#main_content p.call_to_action a {color: <%= @options[:cta_color] %>;background-color: <%= @options[:cta_background_color] %>;}
|
|
10
|
-
</style>
|
|
11
|
-
</head>
|
|
12
|
-
<%= @body_with_inline_css %>
|
|
13
|
-
</html>
|