channel_research_stationery 2.10.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: be8fcc51204385c46925f081845b58c219b823c2
4
+ data.tar.gz: 5db73a74956902fdb88e7c5c703d2e029b323ece
5
+ SHA512:
6
+ metadata.gz: 3f5f9ddaa172edfa781ed39bbb394fc4aa312860c876259994fb203248ac7752f097e3b09f41db64e002b52b13d7e9bf7dcc036c23667415609ebecb87f58a88
7
+ data.tar.gz: 902cdec642b2f97fe80e160c7cae6d5880445e58ff6d3ce951314c1837e79ab94d1bb2deab3ccfc46a0074c5d959c0a6df94034a3463a1000001270ffa163e1a
@@ -0,0 +1,103 @@
1
+ require 'haml'
2
+ require 'premailer'
3
+ require 'nokogiri'
4
+ require 'sassc'
5
+
6
+ class ChannelResearchStationery
7
+ def initialize(content, options = {})
8
+ @content = content
9
+ @primary_color = options.delete(:primary_color) || '#6d6e71'
10
+ @options = default_options.merge(options)
11
+ end
12
+
13
+ def to_text
14
+ Premailer.new(to_html,
15
+ {
16
+ warn_level: Premailer::Warnings::SAFE
17
+ }
18
+ ).to_plain_text
19
+ end
20
+
21
+ def to_html
22
+ @body_with_inline_css = body_with_inline_css
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 )
26
+ end
27
+
28
+ def body_with_inline_css
29
+ doc_with_placeholder_content.at('body').to_html
30
+ end
31
+
32
+ def doc_with_placeholder_content
33
+ doc = Nokogiri::HTML(template_with_inline_css)
34
+ doc.at('div#main_content') << @content
35
+ # Add content-editable bits
36
+ doc.xpath('//*[@class="contenteditable"]').each do |node|
37
+ node['contenteditable'] = 'true'
38
+ end
39
+ return doc
40
+ end
41
+
42
+ def template_with_inline_css
43
+ Premailer.new(template,
44
+ {
45
+ warn_level: Premailer::Warnings::SAFE,
46
+ css_string: css_string,
47
+ with_html_string: true
48
+ }
49
+ ).to_inline_css
50
+ end
51
+
52
+ def placeholder_content
53
+ contents = File.open("lib/generators/templates/placeholder_contents/#{@options['placeholder']}").read
54
+ Haml::Engine.new(contents).render
55
+ end
56
+
57
+ def template
58
+ template_path = File.join( __dir__, "./generators/templates/template.html.haml" )
59
+ contents = File.open(template_path).read
60
+ engine = Haml::Engine.new(contents)
61
+ engine.render(Object.new, { options: @options })
62
+ end
63
+
64
+ def css_string
65
+ reset_css + styles_css
66
+ end
67
+
68
+ def reset_css
69
+ css_path = File.join( __dir__, "./generators/templates/reset.css" )
70
+ File.open(css_path).read
71
+ end
72
+
73
+ def sass_options
74
+ @options.select {|k,v| [:background_color,:header_background_color,:width].include?(k)}
75
+ end
76
+
77
+ def sass_variables
78
+ sass_options.map {|k,v| "$#{k}: #{v};"}.join("\n")
79
+ end
80
+
81
+ def styles_css
82
+ css_path = File.join( __dir__, "./generators/templates/styles.sass" )
83
+ sass_styles = File.open(css_path, "rb").read
84
+ sass = sass_variables + "\n" + sass_styles
85
+ SassC::Engine.new(sass, style: :compressed).render
86
+ end
87
+
88
+ def default_options
89
+ {
90
+ header_background_color: @primary_color,
91
+ link_color: @primary_color,
92
+ bold_color: @primary_color,
93
+ cta_background_color: @primary_color,
94
+ background_color: '#ffffff',
95
+ cta_color: '#ffffff',
96
+ width: '700px',
97
+ badge_left: false,
98
+ badge_right: false,
99
+ title: false,
100
+ subtitle: false
101
+ }
102
+ end
103
+ end
@@ -0,0 +1,13 @@
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>
@@ -0,0 +1,120 @@
1
+ /*
2
+ YUI 3.18.1 (build f7e7bcb)
3
+ Copyright 2014 Yahoo! Inc. All rights reserved.
4
+ Licensed under the BSD License.
5
+ http://yuilibrary.com/license/
6
+ */
7
+
8
+ /*
9
+ TODO will need to remove settings on HTML since we can't namespace it.
10
+ TODO with the prefix, should I group by selector or property for weight savings?
11
+ */
12
+ html{
13
+ color:#000;
14
+ background:#FFF;
15
+ }
16
+ /*
17
+ TODO remove settings on BODY since we can't namespace it.
18
+ */
19
+ /*
20
+ TODO test putting a class on HEAD.
21
+ - Fails on FF.
22
+ */
23
+ body,
24
+ div,
25
+ dl,
26
+ dt,
27
+ dd,
28
+ ul,
29
+ ol,
30
+ li,
31
+ h1,
32
+ h2,
33
+ h3,
34
+ h4,
35
+ h5,
36
+ h6,
37
+ pre,
38
+ code,
39
+ form,
40
+ fieldset,
41
+ legend,
42
+ input,
43
+ textarea,
44
+ p,
45
+ blockquote,
46
+ th,
47
+ td {
48
+ margin:0;
49
+ padding:0;
50
+ }
51
+ table {
52
+ border-collapse:collapse;
53
+ border-spacing:0;
54
+ }
55
+ fieldset,
56
+ img {
57
+ border:0;
58
+ }
59
+ /*
60
+ TODO think about hanlding inheritence differently, maybe letting IE6 fail a bit...
61
+ */
62
+ address,
63
+ caption,
64
+ cite,
65
+ code,
66
+ dfn,
67
+ em,
68
+ strong,
69
+ th,
70
+ var {
71
+ font-style:normal;
72
+ font-weight:normal;
73
+ }
74
+
75
+ ol,
76
+ ul {
77
+ list-style:none;
78
+ }
79
+
80
+ caption,
81
+ th {
82
+ text-align:left;
83
+ }
84
+ h1,
85
+ h2,
86
+ h3,
87
+ h4,
88
+ h5,
89
+ h6 {
90
+ font-size:100%;
91
+ font-weight:normal;
92
+ }
93
+ q:before,
94
+ q:after {
95
+ content:'';
96
+ }
97
+ abbr,
98
+ acronym {
99
+ border:0;
100
+ font-variant:normal;
101
+ }
102
+ /* to preserve line-height and selector appearance */
103
+ sup {
104
+ vertical-align:text-top;
105
+ }
106
+ sub {
107
+ vertical-align:text-bottom;
108
+ }
109
+ input,
110
+ textarea,
111
+ select {
112
+ font-family:inherit;
113
+ font-size:inherit;
114
+ font-weight:inherit;
115
+ *font-size:100%; /*to enable resizing for IE*/
116
+ }
117
+ /*because legend doesn't inherit in IE */
118
+ legend {
119
+ color:#000;
120
+ }
@@ -0,0 +1,89 @@
1
+ body {background-color: $background_color;}
2
+ #background {background-color: $background_color;padding:20px 0px;}
3
+
4
+ table.email-body-wrap {
5
+ max-width: $width;
6
+ td {border:1px solid #d7d7d7;}
7
+ tr#header td {
8
+ background-color: $header_background_color;
9
+ padding: 13px 40px;
10
+ img {
11
+ float: left;
12
+ width: 23px;
13
+ height:28px;
14
+ margin-right:15px;
15
+ }
16
+ h3 {
17
+ color: #ffffff;
18
+ padding-top:8px;
19
+ font-size:13px;
20
+ font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
21
+ letter-spacing: -1px;
22
+ }
23
+ }
24
+ tr#body td {
25
+ background-color:#ffffff;
26
+ padding: 40px 40px;
27
+ img#badge_right {
28
+ float: right;
29
+ margin-left:15px;
30
+ margin-bottom:15px;
31
+ }
32
+ img#badge_left {
33
+ float: left;
34
+ margin-right:15px;
35
+ margin-bottom:15px;
36
+ }
37
+ h1 {
38
+ padding-top:14px;
39
+ font-size:22px;
40
+ // font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
41
+ font-family: Helvetica, Arial, sans-serif;
42
+ // font-family: "MyriadSetProThin", "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
43
+ // font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
44
+ letter-spacing: -1px;
45
+ font-weight: 100;
46
+ line-height: 1.1em;
47
+ color: #000000;
48
+ }
49
+ h2 {
50
+ font-size:18px;
51
+ font-weight:normal;
52
+ font-family: Helvetica, Arial, sans-serif;
53
+ // font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
54
+ letter-spacing: -1px;
55
+ font-weight: 100;
56
+ padding-bottom:36px;
57
+ color: #666666;
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
+ }
69
+ tr#footer td {
70
+ color: #666666;
71
+ padding: 20px 40px;
72
+ font-size:11px;
73
+ font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
74
+ letter-spacing: -1px;
75
+ border:0px;
76
+ }
77
+ tr#signature_catcher td {
78
+ color: #666666;
79
+ padding: 20px 40px;
80
+ font-size:11px;
81
+ font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
82
+ letter-spacing: -1px;
83
+ border:0px;
84
+ }
85
+ .round_about_way_of_100_percent_width_that_helps_with_send_again {
86
+ color: $background_color;
87
+ }
88
+ }
89
+
@@ -0,0 +1,30 @@
1
+ %html
2
+ %body
3
+ #background
4
+ %table.email-body-wrap{align: 'center'}
5
+ %tr#header
6
+ %td
7
+ %img{:alt => "Apple", "aria-hidden" => "true", :src => "https://wwcci-email-assets.s3.amazonaws.com/bnb/images/apple.png"}/
8
+ %h3 Channel Research
9
+ %tr#body
10
+ %td
11
+ - if options[:badge_left]
12
+ %img#badge_left{:alt => "Apple", "aria-hidden" => "true", :src => "https://wwcci-email-assets.s3.amazonaws.com/bnb/images/#{options[:badge_left]}", height: 75}/
13
+ - if options[:badge_right]
14
+ %img#badge_right{:alt => "Apple", "aria-hidden" => "true", :src => "https://wwcci-email-assets.s3.amazonaws.com/bnb/images/#{options[:badge_right]}", height: 75}/
15
+ - if options[:title]
16
+ %h1= options[:title]
17
+ - if options[:subtitle]
18
+ %h2= options[:subtitle]
19
+ %div#main_content
20
+ %tr#footer
21
+ %td
22
+ %p TM and copyright &copy;#{DateTime.now.year} Apple Inc. All rights reserved.
23
+ %tr#signature_catcher
24
+ %td
25
+ %div{class: 'contenteditable'}
26
+ -# There is something about this div that is required by apple email
27
+ -# templates, otherwise your signature gets injected in a weird place
28
+ -# so I'm just leaving it here, empty.
29
+ %div{class: 'round_about_way_of_100_percent_width_that_helps_with_send_again'}
30
+ = '. '*130
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: channel_research_stationery
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.10.1
5
+ platform: ruby
6
+ authors:
7
+ - Channel Research Team
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-06-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: premailer
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: haml
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sassc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Email Stationery for Channel Research Team
70
+ email: no-reply@home.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - lib/channel_research_stationery.rb
76
+ - lib/generators/templates/layout.html.erb
77
+ - lib/generators/templates/reset.css
78
+ - lib/generators/templates/styles.sass
79
+ - lib/generators/templates/template.html.haml
80
+ homepage: https://www.brandnewbox.com
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 2.5.2
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: Stationery
104
+ test_files: []