spree_html_email 0.70.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.
Files changed (40) hide show
  1. data/.gitignore +10 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +27 -0
  4. data/Gemfile.lock +254 -0
  5. data/LICENSE +26 -0
  6. data/README.md +20 -0
  7. data/Rakefile +31 -0
  8. data/Versionfile +10 -0
  9. data/app/assets/javascripts/admin/spree_html_email.js +1 -0
  10. data/app/assets/javascripts/store/spree_html_email.js +1 -0
  11. data/app/assets/stylesheets/admin/spree_html_email.css +3 -0
  12. data/app/assets/stylesheets/email/email.css.sass +115 -0
  13. data/app/assets/stylesheets/email/reset.css.sass +20 -0
  14. data/app/assets/stylesheets/email/screen.css +4 -0
  15. data/app/assets/stylesheets/store/spree_html_email.css +3 -0
  16. data/app/mailers/order_mailer_decorator.rb +3 -0
  17. data/app/mailers/shipment_mailer_decorator.rb +3 -0
  18. data/app/mailers/user_mailer_decorator.rb +3 -0
  19. data/app/views/layouts/email.html.haml +14 -0
  20. data/app/views/order_mailer/cancel_email.html.haml +17 -0
  21. data/app/views/order_mailer/confirm_email.html.haml +17 -0
  22. data/app/views/shared/email/_address.html.haml +12 -0
  23. data/app/views/shared/email/_footer.html.haml +3 -0
  24. data/app/views/shared/email/_header.html.haml +1 -0
  25. data/app/views/shared/email/_order_details.html.haml +64 -0
  26. data/app/views/shared/email/_shipment_details.html.haml +18 -0
  27. data/app/views/shipment_mailer/shipped_email.html.haml +22 -0
  28. data/app/views/user_mailer/reset_password_instructions.html.haml +14 -0
  29. data/config/locales/en.yml +4 -0
  30. data/config/routes.rb +3 -0
  31. data/lib/generators/spree_html_email/install/install_generator.rb +29 -0
  32. data/lib/spree_html_email/engine.rb +32 -0
  33. data/lib/spree_html_email.rb +2 -0
  34. data/script/rails +7 -0
  35. data/spec/mailers/order_mailer_spec.rb +20 -0
  36. data/spec/mailers/shipment_mailer_spec.rb +11 -0
  37. data/spec/mailers/user_mailer_spec.rb +12 -0
  38. data/spec/spec_helper.rb +29 -0
  39. data/spree_html_email.gemspec +26 -0
  40. metadata +139 -0
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ \#*
2
+ *~
3
+ .#*
4
+ .DS_Store
5
+ .idea
6
+ .project
7
+ tmp
8
+ nbproject
9
+ *.swp
10
+ spec/dummy
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/Gemfile ADDED
@@ -0,0 +1,27 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'sqlite3'
4
+
5
+ group :test do
6
+ gem 'rspec-rails', '= 2.6.1'
7
+ end
8
+
9
+ group :cucumber do
10
+ gem 'cucumber-rails', '1.0.0'
11
+ gem 'database_cleaner', '= 0.6.7'
12
+ gem 'nokogiri'
13
+ gem 'capybara', '1.0.1'
14
+ end
15
+
16
+ group :cucumber, :test do
17
+ gem 'faker'
18
+ gem 'factory_girl'
19
+ end
20
+
21
+ if RUBY_VERSION < "1.9"
22
+ gem "ruby-debug"
23
+ else
24
+ gem "ruby-debug19"
25
+ end
26
+
27
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,254 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ spree_html_email (0.70.0)
5
+ haml-rails (>= 0.3)
6
+ sass-rails (>= 3.1.0)
7
+ spree_auth (>= 0.70.0)
8
+ spree_core (>= 0.70.0)
9
+
10
+ GEM
11
+ remote: http://rubygems.org/
12
+ specs:
13
+ actionmailer (3.1.1)
14
+ actionpack (= 3.1.1)
15
+ mail (~> 2.3.0)
16
+ actionpack (3.1.1)
17
+ activemodel (= 3.1.1)
18
+ activesupport (= 3.1.1)
19
+ builder (~> 3.0.0)
20
+ erubis (~> 2.7.0)
21
+ i18n (~> 0.6)
22
+ rack (~> 1.3.2)
23
+ rack-cache (~> 1.1)
24
+ rack-mount (~> 0.8.2)
25
+ rack-test (~> 0.6.1)
26
+ sprockets (~> 2.0.2)
27
+ activemerchant (1.17.0)
28
+ activesupport (>= 2.3.11)
29
+ braintree (>= 2.0.0)
30
+ builder (>= 2.0.0)
31
+ json (>= 1.5.1)
32
+ activemodel (3.1.1)
33
+ activesupport (= 3.1.1)
34
+ builder (~> 3.0.0)
35
+ i18n (~> 0.6)
36
+ activerecord (3.1.1)
37
+ activemodel (= 3.1.1)
38
+ activesupport (= 3.1.1)
39
+ arel (~> 2.2.1)
40
+ tzinfo (~> 0.3.29)
41
+ activeresource (3.1.1)
42
+ activemodel (= 3.1.1)
43
+ activesupport (= 3.1.1)
44
+ activesupport (3.1.1)
45
+ multi_json (~> 1.0)
46
+ acts_as_list (0.1.4)
47
+ archive-tar-minitar (0.5.2)
48
+ arel (2.2.1)
49
+ bcrypt-ruby (3.0.1)
50
+ braintree (2.12.0)
51
+ builder (>= 2.0.0)
52
+ builder (3.0.0)
53
+ cancan (1.6.5)
54
+ capybara (1.0.1)
55
+ mime-types (>= 1.16)
56
+ nokogiri (>= 1.3.3)
57
+ rack (>= 1.0.0)
58
+ rack-test (>= 0.5.4)
59
+ selenium-webdriver (~> 2.0)
60
+ xpath (~> 0.1.4)
61
+ childprocess (0.2.2)
62
+ ffi (~> 1.0.6)
63
+ cocaine (0.2.0)
64
+ columnize (0.3.4)
65
+ cucumber (1.0.6)
66
+ builder (>= 2.1.2)
67
+ diff-lcs (>= 1.1.2)
68
+ gherkin (~> 2.4.18)
69
+ json (>= 1.4.6)
70
+ term-ansicolor (>= 1.0.6)
71
+ cucumber-rails (1.0.0)
72
+ capybara (>= 1.0.0)
73
+ cucumber (~> 1.0.0)
74
+ nokogiri (>= 1.4.4)
75
+ rack-test (>= 0.5.7)
76
+ database_cleaner (0.6.7)
77
+ deface (0.7.0)
78
+ nokogiri (~> 1.5.0)
79
+ rails (>= 3.0.9)
80
+ devise (1.4.7)
81
+ bcrypt-ruby (~> 3.0)
82
+ orm_adapter (~> 0.0.3)
83
+ warden (~> 1.0.3)
84
+ diff-lcs (1.1.3)
85
+ erubis (2.7.0)
86
+ factory_girl (2.2.0)
87
+ activesupport
88
+ faker (1.0.0)
89
+ i18n (~> 0.4)
90
+ ffi (1.0.9)
91
+ gherkin (2.4.21)
92
+ json (>= 1.4.6)
93
+ haml (3.1.3)
94
+ haml-rails (0.3.4)
95
+ actionpack (~> 3.0)
96
+ activesupport (~> 3.0)
97
+ haml (~> 3.0)
98
+ railties (~> 3.0)
99
+ highline (1.5.1)
100
+ hike (1.2.1)
101
+ i18n (0.6.0)
102
+ jquery-rails (1.0.16)
103
+ railties (~> 3.0)
104
+ thor (~> 0.14)
105
+ json (1.6.1)
106
+ json_pure (1.6.1)
107
+ kaminari (0.12.4)
108
+ rails (>= 3.0.0)
109
+ linecache19 (0.5.12)
110
+ ruby_core_source (>= 0.1.4)
111
+ mail (2.3.0)
112
+ i18n (>= 0.4.0)
113
+ mime-types (~> 1.16)
114
+ treetop (~> 1.4.8)
115
+ meta_search (1.1.1)
116
+ actionpack (~> 3.1.0)
117
+ activerecord (~> 3.1.0)
118
+ activesupport (~> 3.1.0)
119
+ polyamorous (~> 0.5.0)
120
+ mime-types (1.16)
121
+ multi_json (1.0.3)
122
+ nested_set (1.6.8)
123
+ activerecord (>= 3.0.0)
124
+ railties (>= 3.0.0)
125
+ nokogiri (1.5.0)
126
+ orm_adapter (0.0.5)
127
+ paperclip (2.4.1)
128
+ activerecord (>= 2.3.0)
129
+ activesupport (>= 2.3.2)
130
+ cocaine (>= 0.0.2)
131
+ mime-types
132
+ polyamorous (0.5.0)
133
+ activerecord (~> 3.0)
134
+ polyglot (0.3.2)
135
+ rack (1.3.4)
136
+ rack-cache (1.1)
137
+ rack (>= 0.4)
138
+ rack-mount (0.8.3)
139
+ rack (>= 1.0.0)
140
+ rack-ssl (1.3.2)
141
+ rack
142
+ rack-test (0.6.1)
143
+ rack (>= 1.0)
144
+ rails (3.1.1)
145
+ actionmailer (= 3.1.1)
146
+ actionpack (= 3.1.1)
147
+ activerecord (= 3.1.1)
148
+ activeresource (= 3.1.1)
149
+ activesupport (= 3.1.1)
150
+ bundler (~> 1.0)
151
+ railties (= 3.1.1)
152
+ railties (3.1.1)
153
+ actionpack (= 3.1.1)
154
+ activesupport (= 3.1.1)
155
+ rack-ssl (~> 1.3.2)
156
+ rake (>= 0.8.7)
157
+ rdoc (~> 3.4)
158
+ thor (~> 0.14.6)
159
+ rake (0.9.2)
160
+ rd_find_by_param (0.1.1)
161
+ activerecord (~> 3.0)
162
+ activesupport (~> 3.0)
163
+ rd_resource_controller (1.0.1)
164
+ rdoc (3.10)
165
+ json (~> 1.4)
166
+ rspec (2.6.0)
167
+ rspec-core (~> 2.6.0)
168
+ rspec-expectations (~> 2.6.0)
169
+ rspec-mocks (~> 2.6.0)
170
+ rspec-core (2.6.4)
171
+ rspec-expectations (2.6.0)
172
+ diff-lcs (~> 1.1.2)
173
+ rspec-mocks (2.6.0)
174
+ rspec-rails (2.6.1)
175
+ actionpack (~> 3.0)
176
+ activesupport (~> 3.0)
177
+ railties (~> 3.0)
178
+ rspec (~> 2.6.0)
179
+ ruby-debug-base19 (0.11.25)
180
+ columnize (>= 0.3.1)
181
+ linecache19 (>= 0.5.11)
182
+ ruby_core_source (>= 0.1.4)
183
+ ruby-debug19 (0.11.6)
184
+ columnize (>= 0.3.1)
185
+ linecache19 (>= 0.5.11)
186
+ ruby-debug-base19 (>= 0.11.19)
187
+ ruby_core_source (0.1.5)
188
+ archive-tar-minitar (>= 0.5.2)
189
+ rubyzip (0.9.4)
190
+ sass (3.1.10)
191
+ sass-rails (3.1.4)
192
+ actionpack (~> 3.1.0)
193
+ railties (~> 3.1.0)
194
+ sass (>= 3.1.4)
195
+ sprockets (~> 2.0.0)
196
+ tilt (~> 1.3.2)
197
+ selenium-webdriver (2.8.0)
198
+ childprocess (>= 0.2.1)
199
+ ffi (>= 1.0.7)
200
+ json_pure
201
+ rubyzip
202
+ spree_auth (0.70.0)
203
+ cancan (= 1.6.5)
204
+ devise (= 1.4.7)
205
+ spree_core (= 0.70.0)
206
+ spree_core (0.70.0)
207
+ activemerchant (= 1.17.0)
208
+ acts_as_list (= 0.1.4)
209
+ deface (>= 0.6.1)
210
+ faker (= 1.0.0)
211
+ highline (= 1.5.1)
212
+ jquery-rails (>= 1.0.14)
213
+ kaminari (>= 0.12.4)
214
+ meta_search (= 1.1.1)
215
+ nested_set (= 1.6.8)
216
+ paperclip (= 2.4.1)
217
+ rails (= 3.1.1)
218
+ rd_find_by_param (= 0.1.1)
219
+ rd_resource_controller
220
+ state_machine (= 1.0.1)
221
+ stringex (= 1.0.3)
222
+ sprockets (2.0.3)
223
+ hike (~> 1.2)
224
+ rack (~> 1.0)
225
+ tilt (~> 1.1, != 1.3.0)
226
+ sqlite3 (1.3.4)
227
+ state_machine (1.0.1)
228
+ stringex (1.0.3)
229
+ term-ansicolor (1.0.7)
230
+ thor (0.14.6)
231
+ tilt (1.3.3)
232
+ treetop (1.4.10)
233
+ polyglot
234
+ polyglot (>= 0.3.1)
235
+ tzinfo (0.3.30)
236
+ warden (1.0.6)
237
+ rack (>= 1.0)
238
+ xpath (0.1.4)
239
+ nokogiri (~> 1.3)
240
+
241
+ PLATFORMS
242
+ ruby
243
+
244
+ DEPENDENCIES
245
+ capybara (= 1.0.1)
246
+ cucumber-rails (= 1.0.0)
247
+ database_cleaner (= 0.6.7)
248
+ factory_girl
249
+ faker
250
+ nokogiri
251
+ rspec-rails (= 2.6.1)
252
+ ruby-debug19
253
+ spree_html_email!
254
+ sqlite3
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2011 [name of plugin creator]
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name Spree nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,20 @@
1
+ SpreeHtmlEmail
2
+ ==============
3
+
4
+ Introduction goes here.
5
+
6
+
7
+ Example
8
+ =======
9
+
10
+ Example goes here.
11
+
12
+ Testing
13
+ -------
14
+
15
+ Be sure to add the rspec-rails gem to your Gemfile and then create a dummy test app for the specs to run against.
16
+
17
+ $ bundle exec rake test app
18
+ $ bundle exec rspec spec
19
+
20
+ Copyright (c) 2011 [name of extension creator], released under the New BSD License
data/Rakefile ADDED
@@ -0,0 +1,31 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/packagetask'
4
+ require 'rubygems/package_task'
5
+ require 'rspec/core/rake_task'
6
+ require 'cucumber/rake/task'
7
+ require 'spree_core/testing_support/common_rake'
8
+
9
+ RSpec::Core::RakeTask.new
10
+ Cucumber::Rake::Task.new
11
+
12
+ task :default => [:spec, :cucumber ]
13
+
14
+ spec = eval(File.read('spree_html_email.gemspec'))
15
+
16
+ Gem::PackageTask.new(spec) do |p|
17
+ p.gem_spec = spec
18
+ end
19
+
20
+ desc "Release to gemcutter"
21
+ task :release => :package do
22
+ require 'rake/gemcutter'
23
+ Rake::Gemcutter::Tasks.new(spec).define
24
+ Rake::Task['gem:push'].invoke
25
+ end
26
+
27
+ desc "Generates a dummy app for testing"
28
+ task :test_app do
29
+ ENV['LIB_NAME'] = 'spree_html_email'
30
+ Rake::Task['common:test_app'].invoke
31
+ end
data/Versionfile ADDED
@@ -0,0 +1,10 @@
1
+ # This file is used to designate compatibilty with different versions of Spree
2
+ # Please see http://spreecommerce.com/documentation/extensions.html#versionfile for details
3
+
4
+ # Examples
5
+ #
6
+ # "0.70.x" => { :branch => "master"}
7
+ # "0.60.x" => { :branch => "0-60-stable" }
8
+ # "0.40.x" => { :tag => "v1.0.0", :version => "1.0.0" }
9
+
10
+ "0.70.x" => { :tag => "v0.1.0"}
@@ -0,0 +1 @@
1
+ //= require admin/spree_core
@@ -0,0 +1 @@
1
+ //= require store/spree_core
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require admin/spree_core
3
+ */
@@ -0,0 +1,115 @@
1
+ $background-color: #15D
2
+ $border-color: #AAA
3
+ $text-color: #222
4
+ $box-shadow-color: #665
5
+ $table-border: 1px solid #ccc
6
+ $table-row-alt-color: #eee
7
+ $table-row-divider: 1px solid #DDD
8
+
9
+ body
10
+ font-family: sans-serif
11
+ background: $background-color
12
+ color: $text-color
13
+
14
+ a
15
+ color: $text-color
16
+ font-weight: bold
17
+
18
+ h1, h2, h3, h4
19
+ font-weight: bold
20
+ color: $background-color
21
+
22
+ h1
23
+ font-size: 22px
24
+ margin: 10px 0
25
+
26
+ p
27
+ margin: 10px 0
28
+
29
+ #wrapper
30
+ margin: 0px auto 30px
31
+ width: 600px
32
+ background: white
33
+ padding: 20px 40px 40px
34
+ box-shadow: 4px 5px 4px $box-shadow-color
35
+ border-radius: 0 0px 4px
36
+
37
+ footer
38
+ font-size: 11px
39
+
40
+ table
41
+ display: table
42
+ border: $table-border
43
+ border-right-color: $border-color
44
+ border-bottom-color: $border-color
45
+ width: 100%
46
+
47
+ .number
48
+ text-align: right
49
+ min-width: 45px
50
+
51
+ th
52
+ background: $background-color
53
+ color: white
54
+ padding: 7px 10px
55
+ text-shadow: $text-color 1px 1px 0px
56
+ font-weight: bold
57
+
58
+ tr.alt td
59
+ background: $table-row-alt-color
60
+
61
+ td
62
+ border-bottom: $table-row-divider
63
+ padding: 6px 10px
64
+ border-style: inset
65
+
66
+ &.name
67
+ min-width: 180px
68
+
69
+ &.title, &.subtotal
70
+ font-weight: bold
71
+
72
+ table.split
73
+ td
74
+ width: 50%
75
+
76
+ #order_total
77
+ font-weight: bold
78
+
79
+ #subtotal-row td, #order-total td
80
+ border-top: solid 1px $border-color
81
+
82
+ #addresses
83
+ width: 600px
84
+
85
+ .address
86
+ width: 292px
87
+
88
+ &#billing
89
+ float: left
90
+
91
+ &#shipping
92
+ float: right
93
+
94
+
95
+
96
+ .address
97
+ margin: 10px 0
98
+ border: $table-border
99
+ border-right-color: $border-color
100
+ border-bottom-color: $border-color
101
+
102
+ h2
103
+ font-size: 16px
104
+ display: block
105
+ margin: 0
106
+ padding: 8px
107
+ background: $background-color
108
+ color: white
109
+ text-shadow: $text-color 1px 1px 0px
110
+
111
+ .details
112
+ padding: 10px
113
+
114
+ .full-name
115
+ font-weight: bold
@@ -0,0 +1,20 @@
1
+ html, body, div, form, fieldset, legend, label
2
+ margin: 0
3
+ padding: 0
4
+
5
+ table
6
+ border-collapse: collapse
7
+ border-spacing: 0
8
+
9
+ th, td
10
+ text-align: left
11
+ vertical-align: top
12
+
13
+ h1, h2, h3, h4, h5, h6, th, td, caption
14
+ font-weight: normal
15
+
16
+ img
17
+ border: 0
18
+
19
+ header, footer, section
20
+ display: block
@@ -0,0 +1,4 @@
1
+ /*
2
+ *= require email/reset
3
+ *= require email/email
4
+ */
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require store/spree_core
3
+ */
@@ -0,0 +1,3 @@
1
+ OrderMailer.class_eval do
2
+ layout 'email'
3
+ end
@@ -0,0 +1,3 @@
1
+ ShipmentMailer.class_eval do
2
+ layout 'email'
3
+ end
@@ -0,0 +1,3 @@
1
+ UserMailer.class_eval do
2
+ layout 'email'
3
+ end
@@ -0,0 +1,14 @@
1
+ !!! html
2
+ %html
3
+ %head
4
+ %link{:rel => 'stylesheet', :type => 'text/css', :media => 'screen', :href => "http://#{Spree::Config[:site_url] }#{asset_path('email/screen')}"}
5
+ %body
6
+ #wrapper
7
+ %header
8
+ = render :partial => 'shared/email/header'
9
+
10
+ %section#main
11
+ = yield
12
+
13
+ %footer
14
+ = render :partial => 'shared/email/footer'
@@ -0,0 +1,17 @@
1
+ %p.customer
2
+ = t(:dear_customer, :default => "Dear %{name},", :name => @order.bill_address ? @order.bill_address.full_name : 'Customer' )
3
+
4
+ %p.overview
5
+ Your order has been <b>CANCELED</b>. Please retain this cancellation information for your records.
6
+
7
+ %p.link
8
+ To view the complete details of your order use the following link:
9
+ = link_to(order_url(@order, :host => Spree::Config[:site_url]), order_url(@order, :host => Spree::Config[:site_url]))
10
+
11
+ %h1
12
+ Order Summary [CANCELED]
13
+
14
+ = render :partial => 'shared/email/order_details', :locals => {:order => @order}
15
+
16
+ %p.thank-you
17
+ Thank you for your business.
@@ -0,0 +1,17 @@
1
+ %p.customer
2
+ = t(:dear_customer, :default => "Dear %{name},", :name => @order.bill_address ? @order.bill_address.full_name : 'Customer' )
3
+
4
+ %p.overview
5
+ Please review and retain the following order information for your records.
6
+
7
+ %p.link
8
+ To view the complete details of your order use the following link:
9
+ = link_to(order_url(@order, :host => Spree::Config[:site_url]), order_url(@order, :host => Spree::Config[:site_url]))
10
+
11
+ %h1
12
+ Order Summary
13
+
14
+ = render :partial => 'shared/email/order_details', :locals => {:order => @order}
15
+
16
+ %p.thank-you
17
+ Thank you for your business.
@@ -0,0 +1,12 @@
1
+ .details
2
+ %span.full-name= address.full_name
3
+ %br
4
+ = address.address1
5
+ - if address.address2.present?
6
+ %br
7
+ = address.address2
8
+ %br
9
+ = [address.city, address.state ? address.state.name : address.state_name].join(', ')
10
+ %br
11
+ = address.country.name
12
+ = address.zipcode
@@ -0,0 +1,3 @@
1
+ &copy; Copyright
2
+ = Date.today.year
3
+ = link_to(Spree::Config[:site_title], "http://#{ Spree::Config[:site_url] }")
@@ -0,0 +1 @@
1
+ = link_to(image_tag("http://#{Spree::Config[:site_url]}#{ image_path(Spree::Config[:logo]) }"), "http://#{ Spree::Config[:site_url] }")
@@ -0,0 +1,64 @@
1
+ %table.split
2
+ %tr
3
+ %th{:colspan => 2}
4
+ Order Details
5
+ %tr
6
+ %td Number
7
+ %td= order.number
8
+ %tr.alt
9
+ %td Payment Method
10
+ %td= order.payments.collect {|p| p.payment_method.name }.join(', ')
11
+
12
+ - if order.canceled?
13
+ %tr
14
+ %td Status
15
+ %td Canceled
16
+ - else
17
+ %tr
18
+ %td Submitted
19
+ %td= l(order.completed_at, :format => :short)
20
+
21
+ #addresses
22
+ .address#billing
23
+ %h2= t(:billing_address)
24
+ = render :partial => 'shared/email/address', :locals => {:address => order.bill_address}
25
+ .address#shipping
26
+ %h2= t(:shipping_address)
27
+ = render :partial => 'shared/email/address', :locals => {:address => order.ship_address}
28
+
29
+ %table{"data-hook" => "order_details"}
30
+ %tbody#line-items{"data-hook" => ""}
31
+ %tr{"data-hook" => "order_details_line_items_headers"}
32
+ %th= t(:item_description)
33
+ %th.price.number= t(:price)
34
+ %th.qty.number= t(:qty)
35
+ %th.total.number= t(:total)
36
+ - order.line_items.each do |item|
37
+ %tr{"data-hook" => "order_details_line_item_row", :class => cycle('', 'alt')}
38
+ %td.name
39
+ = item.variant.product.name
40
+ = "(" + variant_options(item.variant) + ")" unless item.variant .option_values.empty?
41
+ %td.price.number= number_to_currency(item.price)
42
+ %td.qty.number= item.quantity
43
+ %td.total.number= number_to_currency(item.price * item.quantity)
44
+ %tbody#subtotal{"data-hook" => "order_details_subtotal"}
45
+ %tr#subtotal-row.total{:class => cycle('', 'alt')}
46
+ %td.title{:colspan => "3"}
47
+ = t(:subtotal)
48
+ %td.total.number
49
+ = number_to_currency order.item_total
50
+ %tbody#order-charges{"data-hook" => "order_details_adjustments"}
51
+ - order.adjustments.eligible.each do |adjustment|
52
+ - next if (adjustment.originator_type == "TaxRate") and (adjustment.amount == 0)
53
+ %tr.total{:class => cycle('', 'alt')}
54
+ %td.title{:colspan => "3"}
55
+ = adjustment.label
56
+ %td.total.number
57
+ = number_to_currency adjustment.amount
58
+ %tbody#order-total{"data-hook" => "order_details_total"}
59
+ %tr.total{:class => cycle('', 'alt')}
60
+ %td.title{:colspan => "3"}
61
+ = t(:order_total)
62
+ %td.total.number
63
+ %span#order_total= number_to_currency order.total
64
+
@@ -0,0 +1,18 @@
1
+ .address#shipping
2
+ %h2= t(:shipping_address)
3
+ = render :partial => 'shared/email/address', :locals => {:address => shipment.address}
4
+
5
+ %table{"data-hook" => "shipment_details"}
6
+ %tbody#line-items{"data-hook" => ""}
7
+ %tr{"data-hook" => "shipment_details_line_items_headers"}
8
+ %th= t(:item_description)
9
+ %th.qty.number= t(:qty)
10
+ %th= t(:status)
11
+ - shipment.line_items.each do |item|
12
+ %tr{"data-hook" => "shipment_details_line_item_row", :class => cycle('', 'alt')}
13
+ %td.name
14
+ = item.variant.product.name
15
+ = "(" + variant_options(item.variant) + ")" unless item.variant .option_values.empty?
16
+ %td.qty.number= item.quantity
17
+ %td= t('shipped')
18
+
@@ -0,0 +1,22 @@
1
+ %p.customer
2
+ = t(:dear_customer, :default => "Dear %{name},", :name => @shipment.order.bill_address ? @shipment.order.bill_address.full_name : 'Customer' )
3
+
4
+ %p.overview
5
+ Your shipment has been shipped
6
+
7
+ %p.link
8
+ To view the complete details of your order use the following link:
9
+ = link_to(order_url(@shipment.order, :host => Spree::Config[:site_url]), order_url(@shipment.order, :host => Spree::Config[:site_url]))
10
+
11
+ %h1
12
+ Shipment Summary
13
+
14
+ = render :partial => 'shared/email/shipment_details', :locals => {:shipment => @shipment}
15
+
16
+ - if @shipment.tracking.present?
17
+ %p.tracking
18
+ Tracking Information:
19
+ = @shipment.tracking
20
+
21
+ %p.thank-you
22
+ Thank you for your business.
@@ -0,0 +1,14 @@
1
+ %h1 Resetting your password
2
+
3
+ %p.overview
4
+ A request to reset your password has been made.
5
+ If you did not make this request, simply ignore this email.
6
+
7
+ %p.link
8
+ If you did make this request just click the link below:
9
+ %br
10
+ = link_to @edit_password_reset_url, @edit_password_reset_url
11
+
12
+ %p
13
+ If the above URL does not work try copying and pasting it into your browser.
14
+ If you continue to have problem please feel free to contact us.
@@ -0,0 +1,4 @@
1
+ en:
2
+ time:
3
+ formats:
4
+ short: "%B %d, %Y"
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ # Add your extension routes here
3
+ end
@@ -0,0 +1,29 @@
1
+ module SpreeHtmlEmail
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+
5
+ def add_javascripts
6
+ append_file "app/assets/javascripts/store/all.js", "//= require store/spree_html_email\n"
7
+ append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_html_email\n"
8
+ end
9
+
10
+ def add_stylesheets
11
+ inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree_html_email\n", :before => /\*\//, :verbose => true
12
+ inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/spree_html_email\n", :before => /\*\//, :verbose => true
13
+ end
14
+
15
+ def add_migrations
16
+ run 'bundle exec rake railties:install:migrations FROM=spree_html_email'
17
+ end
18
+
19
+ def run_migrations
20
+ res = ask "Would you like to run the migrations now? [Y/n]"
21
+ if res == "" || res.downcase == "y"
22
+ run 'bundle exec rake db:migrate'
23
+ else
24
+ puts "Skiping rake db:migrate, don't forget to run it!"
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,32 @@
1
+ require 'haml'
2
+
3
+ module SpreeHtmlEmail
4
+ class Engine < Rails::Engine
5
+ engine_name 'spree_html_email'
6
+
7
+ config.autoload_paths += %W(#{config.root}/lib)
8
+
9
+ # use rspec for tests
10
+ config.generators do |g|
11
+ g.test_framework :rspec
12
+ g.template_engine :haml
13
+ end
14
+
15
+ config.before_initialize do
16
+ Haml.init_rails(binding)
17
+ Haml::Template.options[:format] = :html5
18
+ end
19
+
20
+ def self.activate
21
+ Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
22
+ Rails.application.config.cache_classes ? require(c) : load(c)
23
+ end
24
+
25
+ Dir.glob(File.join(File.dirname(__FILE__), "../../app/overrides/*.rb")) do |c|
26
+ Rails.application.config.cache_classes ? require(c) : load(c)
27
+ end
28
+ end
29
+
30
+ config.to_prepare &method(:activate).to_proc
31
+ end
32
+ end
@@ -0,0 +1,2 @@
1
+ require 'spree_core'
2
+ require 'spree_html_email/engine'
data/script/rails ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+
5
+ ENGINE_PATH = File.expand_path('../..', __FILE__)
6
+ load File.expand_path('../../spec/dummy/script/rails', __FILE__)
7
+
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe OrderMailer do
4
+ let(:order) { Factory(:order,
5
+ :completed_at => Time.now,
6
+ :bill_address => Factory(:address),
7
+ :ship_address => Factory(:address)) }
8
+
9
+ context "confirmation email" do
10
+ let(:email) { OrderMailer.confirm_email(order) }
11
+
12
+ specify { email.content_type.should match("text/html") }
13
+ end
14
+
15
+ context "cancelation email" do
16
+ let(:email) { OrderMailer.cancel_email(order) }
17
+
18
+ specify { email.content_type.should match("text/html") }
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe ShipmentMailer do
4
+ let(:shipment) { Factory(:shipment) }
5
+
6
+ context "shipped email" do
7
+ let(:email) { ShipmentMailer.shipped_email(shipment) }
8
+
9
+ specify { email.content_type.should match("text/html") }
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+ require 'user_mailer'
3
+
4
+ describe UserMailer do
5
+ let(:user) { mock(:user) }
6
+
7
+ context "reset password instructions email" do
8
+ let(:email) { UserMailer.reset_password_instructions(user) }
9
+
10
+ specify { email.content_type.should match("text/html") }
11
+ end
12
+ end
@@ -0,0 +1,29 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
+ require 'rspec/rails'
5
+
6
+ # Requires supporting ruby files with custom matchers and macros, etc,
7
+ # in spec/support/ and its subdirectories.
8
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
9
+
10
+ require 'spree_core/testing_support/factories'
11
+
12
+ RSpec.configure do |config|
13
+ # == Mock Framework
14
+ #
15
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
16
+ #
17
+ # config.mock_with :mocha
18
+ # config.mock_with :flexmock
19
+ # config.mock_with :rr
20
+ config.mock_with :rspec
21
+
22
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
23
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
24
+
25
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
26
+ # examples within a transaction, remove the following line or assign false
27
+ # instead of true.
28
+ config.use_transactional_fixtures = true
29
+ end
@@ -0,0 +1,26 @@
1
+ # encoding: UTF-8
2
+ Gem::Specification.new do |s|
3
+ s.platform = Gem::Platform::RUBY
4
+ s.name = 'spree_html_email'
5
+ s.version = '0.70.0'
6
+ s.summary = 'HTML email support for Spree'
7
+ s.description = "Provides html email templates for all Spree's outgoing emails"
8
+ s.required_ruby_version = '>= 1.8.7'
9
+
10
+ s.author = 'Joshua Nussbaum'
11
+ s.email = 'joshnuss@gmail.com'
12
+ # s.homepage = 'http://www.rubyonrails.org'
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.require_path = 'lib'
17
+ s.requirements << 'none'
18
+
19
+ s.add_dependency 'spree_core', '>= 0.70.0'
20
+ s.add_dependency 'spree_auth', '>= 0.70.0'
21
+ s.add_dependency 'sass-rails', '>= 3.1.0'
22
+ s.add_dependency 'haml-rails', '>= 0.3'
23
+
24
+ s.add_development_dependency 'rspec-rails'
25
+ end
26
+
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spree_html_email
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.70.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Joshua Nussbaum
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-23 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: spree_core
16
+ requirement: &78105040 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.70.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *78105040
25
+ - !ruby/object:Gem::Dependency
26
+ name: spree_auth
27
+ requirement: &78104680 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 0.70.0
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *78104680
36
+ - !ruby/object:Gem::Dependency
37
+ name: sass-rails
38
+ requirement: &78104380 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 3.1.0
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *78104380
47
+ - !ruby/object:Gem::Dependency
48
+ name: haml-rails
49
+ requirement: &78104020 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0.3'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *78104020
58
+ - !ruby/object:Gem::Dependency
59
+ name: rspec-rails
60
+ requirement: &78103650 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *78103650
69
+ description: Provides html email templates for all Spree's outgoing emails
70
+ email: joshnuss@gmail.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - .gitignore
76
+ - .rspec
77
+ - Gemfile
78
+ - Gemfile.lock
79
+ - LICENSE
80
+ - README.md
81
+ - Rakefile
82
+ - Versionfile
83
+ - app/assets/javascripts/admin/spree_html_email.js
84
+ - app/assets/javascripts/store/spree_html_email.js
85
+ - app/assets/stylesheets/admin/spree_html_email.css
86
+ - app/assets/stylesheets/email/email.css.sass
87
+ - app/assets/stylesheets/email/reset.css.sass
88
+ - app/assets/stylesheets/email/screen.css
89
+ - app/assets/stylesheets/store/spree_html_email.css
90
+ - app/mailers/order_mailer_decorator.rb
91
+ - app/mailers/shipment_mailer_decorator.rb
92
+ - app/mailers/user_mailer_decorator.rb
93
+ - app/views/layouts/email.html.haml
94
+ - app/views/order_mailer/cancel_email.html.haml
95
+ - app/views/order_mailer/confirm_email.html.haml
96
+ - app/views/shared/email/_address.html.haml
97
+ - app/views/shared/email/_footer.html.haml
98
+ - app/views/shared/email/_header.html.haml
99
+ - app/views/shared/email/_order_details.html.haml
100
+ - app/views/shared/email/_shipment_details.html.haml
101
+ - app/views/shipment_mailer/shipped_email.html.haml
102
+ - app/views/user_mailer/reset_password_instructions.html.haml
103
+ - config/locales/en.yml
104
+ - config/routes.rb
105
+ - lib/generators/spree_html_email/install/install_generator.rb
106
+ - lib/spree_html_email.rb
107
+ - lib/spree_html_email/engine.rb
108
+ - script/rails
109
+ - spec/mailers/order_mailer_spec.rb
110
+ - spec/mailers/shipment_mailer_spec.rb
111
+ - spec/mailers/user_mailer_spec.rb
112
+ - spec/spec_helper.rb
113
+ - spree_html_email.gemspec
114
+ homepage:
115
+ licenses: []
116
+ post_install_message:
117
+ rdoc_options: []
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: 1.8.7
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements:
133
+ - none
134
+ rubyforge_project:
135
+ rubygems_version: 1.8.6
136
+ signing_key:
137
+ specification_version: 3
138
+ summary: HTML email support for Spree
139
+ test_files: []