effective_orders 1.6.6 → 1.7.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.
- checksums.yaml +4 -4
- data/app/mailers/effective/orders_mailer.rb +2 -1
- data/app/views/effective/orders/_order_header.html.haml +1 -4
- data/app/views/effective/orders/_order_items.html.haml +18 -12
- data/app/views/effective/orders_mailer/order_receipt_to_admin.html.haml +2 -8
- data/app/views/effective/orders_mailer/order_receipt_to_buyer.html.haml +2 -8
- data/app/views/effective/orders_mailer/order_receipt_to_seller.html.haml +24 -29
- data/app/views/layouts/effective_orders_mailer_layout.html.haml +27 -0
- data/lib/effective_orders/version.rb +1 -1
- data/lib/generators/templates/effective_orders.rb +1 -0
- data/spec/controllers/orders_controller_spec.rb +1 -1
- data/spec/dummy/log/test.log +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb1d6669051ee4a4c2caf28dccbac451bdd3221b
|
4
|
+
data.tar.gz: 6ad503455f871663204142a019802e58e0761139
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 384f81697a59dce11cd020734531dc460d4d2e6fbb771687d13179375ad166d7f4c01d9a21b819018e2d91ddf760e605f1c1e022645a72e9bbfa7f92b212f63d
|
7
|
+
data.tar.gz: 49ed6f3e16ca6745070ac459f181f20c89767b3dd7a472a2424aec5415f91724237c589ac667e853010e58458cc545015771e04f0c1242db8bb80a84c8fea4fe
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module Effective
|
2
2
|
class OrdersMailer < ActionMailer::Base
|
3
3
|
helper EffectiveOrdersHelper
|
4
|
-
|
5
4
|
default :from => EffectiveOrders.mailer[:default_from]
|
6
5
|
|
6
|
+
layout EffectiveOrders.mailer[:layout].presence || 'effective_orders_mailer_layout'
|
7
|
+
|
7
8
|
def order_receipt_to_admin(order)
|
8
9
|
@order = order
|
9
10
|
mail(:to => EffectiveOrders.mailer[:admin_email], :subject => receipt_to_admin_subject(order))
|
@@ -14,10 +14,7 @@
|
|
14
14
|
.col-sm-6
|
15
15
|
- if order.purchased?
|
16
16
|
%p Receipt: ##{order.to_param}
|
17
|
+
%p Purchased at: #{order.purchased_at.strftime("%Y-%m-%d %H:%M")}
|
17
18
|
- elsif order.persisted?
|
18
19
|
%p Order: ##{order.to_param}
|
19
|
-
|
20
|
-
- if order.purchased?
|
21
|
-
%p Purchased at: #{order.purchased_at.strftime("%Y-%m-%d %H:%M")}
|
22
|
-
- else
|
23
20
|
%p Date: #{Time.zone.now.strftime("%Y-%m-%d %H:%M")}
|
@@ -1,48 +1,54 @@
|
|
1
1
|
- include_download_column = order.purchased? && order.order_items.any? { |order_item| order_item.purchased_download_url.present? rescue false }
|
2
|
+
- include_quantity_column = order.order_items.any? { |order_item| order_item.quantity > 1 }
|
2
3
|
|
3
|
-
.effective-order
|
4
|
+
.effective-order-items
|
4
5
|
%table.table
|
5
6
|
%thead
|
6
7
|
%tr
|
7
|
-
|
8
|
-
|
8
|
+
- if include_quantity_column
|
9
|
+
%th.quantity Qty
|
9
10
|
- if include_download_column
|
10
11
|
%th.download Download
|
12
|
+
%th.item= order.order_items.length > 1 ? 'Items' : 'Item'
|
11
13
|
%th.price Price
|
12
14
|
|
13
15
|
%tbody
|
14
16
|
- order.order_items.each do |item|
|
15
17
|
%tr
|
16
|
-
|
17
|
-
|
18
|
-
= item.title.html_safe
|
19
|
-
- if order.new_record? && item.purchasable.kind_of?(Effective::Subscription)
|
20
|
-
= render :partial => 'effective/orders/stripe/subscription_fields', :locals => {:form => form, :subscription => item.purchasable }
|
21
|
-
|
18
|
+
- if include_quantity_column
|
19
|
+
%td.quantity= item.quantity
|
22
20
|
- if include_download_column
|
23
21
|
%td.download
|
24
22
|
- if item.purchased? && (item.purchased_download_url rescue nil).present?
|
25
23
|
= link_to 'download', item.purchased_download_url
|
26
24
|
- else
|
27
25
|
= '-'
|
26
|
+
%td.item
|
27
|
+
= item.title.html_safe
|
28
|
+
- if order.new_record? && item.purchasable.kind_of?(Effective::Subscription)
|
29
|
+
= render :partial => 'effective/orders/stripe/subscription_fields', :locals => {:form => form, :subscription => item.purchasable }
|
30
|
+
|
28
31
|
%td.price= price_to_currency(item.price)
|
29
32
|
|
30
33
|
%tfoot
|
31
34
|
- if order.tax > 0
|
32
35
|
%tr
|
33
|
-
|
36
|
+
- if include_quantity_column
|
37
|
+
%th.quantity
|
34
38
|
- if include_download_column
|
35
39
|
%th.download
|
36
40
|
%th.subtotal Subtotal
|
37
41
|
%td.price.subtotal-price= price_to_currency(order.subtotal)
|
38
42
|
%tr
|
39
|
-
|
43
|
+
- if include_quantity_column
|
44
|
+
%th.quantity
|
40
45
|
- if include_download_column
|
41
46
|
%th.download
|
42
47
|
%th.tax Tax
|
43
48
|
%td.price.tax-price= price_to_currency(order.tax)
|
44
49
|
%tr
|
45
|
-
|
50
|
+
- if include_quantity_column
|
51
|
+
%th.quantity
|
46
52
|
- if include_download_column
|
47
53
|
%th.download
|
48
54
|
%th.total Total Due
|
@@ -1,8 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
%head
|
4
|
-
%meta{:content => 'text/html; charset=UTF-8', 'http-equiv' => "Content-Type"}
|
5
|
-
%body
|
6
|
-
%p An order has been successfully purchased:
|
7
|
-
|
8
|
-
= render(@order, no_order_actions: true)
|
1
|
+
%p.effective-orders-receipt-info An order has been successfully purchased:
|
2
|
+
= render(@order, no_order_actions: true)
|
@@ -1,8 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
%head
|
4
|
-
%meta{:content => 'text/html; charset=UTF-8', 'http-equiv' => "Content-Type"}
|
5
|
-
%body
|
6
|
-
%p Your order has been successfully purchased:
|
7
|
-
|
8
|
-
= render(@order, no_order_actions: true)
|
1
|
+
%p.effective-orders-receipt-info Your order has been successfully purchased:
|
2
|
+
= render(@order, no_order_actions: true)
|
@@ -1,30 +1,25 @@
|
|
1
|
-
|
2
|
-
%html
|
3
|
-
%head
|
4
|
-
%meta{:content => 'text/html; charset=UTF-8', 'http-equiv' => "Content-Type"}
|
5
|
-
%body
|
6
|
-
%p= @subject
|
1
|
+
%p.effective-orders-receipt-info= @subject
|
7
2
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
3
|
+
%table.table
|
4
|
+
%thead
|
5
|
+
%tr
|
6
|
+
%th Item
|
7
|
+
%th Price
|
8
|
+
%tbody
|
9
|
+
- @order_items.each do |item|
|
10
|
+
%tr
|
11
|
+
%td
|
12
|
+
- if item.quantity > 1
|
13
|
+
= "#{item.quantity}x "
|
14
|
+
= item.title
|
15
|
+
%td= price_to_currency(item.subtotal)
|
16
|
+
%tfoot
|
17
|
+
%tr
|
18
|
+
%th Subtotal
|
19
|
+
%td= price_to_currency(@order_items.map { |oi| oi.subtotal }.sum)
|
20
|
+
%tr
|
21
|
+
%th Tax
|
22
|
+
%td= price_to_currency(@order_items.map { |oi| oi.tax }.sum)
|
23
|
+
%tr
|
24
|
+
%th Total
|
25
|
+
%td= price_to_currency(@order_items.map { |oi| oi.total }.sum)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
!!!
|
2
|
+
%html{style: 'background: #fff;'}
|
3
|
+
%head
|
4
|
+
%meta{:content => 'text/html; charset=UTF-8', 'http-equiv' => 'Content-Type'}
|
5
|
+
:css
|
6
|
+
.effective-order table.table { min-width: 650px; }
|
7
|
+
.effective-order { text-align: left; }
|
8
|
+
.effective-order .price { text-align: right; }
|
9
|
+
.effective-order tfoot th { text-align: right; }
|
10
|
+
.effective-order tfoot tr:first-child td { padding-top: 24px; }
|
11
|
+
.effective-order tfoot tr:first-child th { padding-top: 24px; }
|
12
|
+
.effective-order-shipping { padding-top: 12px; padding-bottom: 12px; }
|
13
|
+
|
14
|
+
%body{style: 'background: #fff;'}
|
15
|
+
%table{style: 'width: 100%;'}
|
16
|
+
%tr
|
17
|
+
%td
|
18
|
+
%table{style: 'max-width: 650px; margin: 4px auto 30px;'}
|
19
|
+
%thead{style: 'border-bottom: 2px solid transparent; width: 100%;'}
|
20
|
+
%tr{style: 'background: #000; color: #fff;'}
|
21
|
+
%th{style: 'padding-top: 2px;'}
|
22
|
+
%tbody{style: 'background: #fff; width: 100%; margin-bottom: 4px;'}
|
23
|
+
%tr
|
24
|
+
%td= yield
|
25
|
+
%tfoot{style: 'border-bottom: 2px solid transparent; width: 100%;'}
|
26
|
+
%tr{style: 'background: #000; color: #fff;'}
|
27
|
+
%th{style: 'padding-top: 2px;'}
|
@@ -139,6 +139,7 @@ EffectiveOrders.setup do |config|
|
|
139
139
|
:send_order_receipt_to_admin => true,
|
140
140
|
:send_order_receipt_to_buyer => true,
|
141
141
|
:send_order_receipt_to_seller => true, # Only applies to StripeConnect
|
142
|
+
:layout => 'effective_orders_mailer_layout',
|
142
143
|
:admin_email => 'admin@example.com',
|
143
144
|
:default_from => 'info@example.com',
|
144
145
|
:subject_prefix => '[example]',
|
@@ -345,7 +345,7 @@ describe Effective::OrdersController, type: :controller do
|
|
345
345
|
it 'creates a purchased order' do
|
346
346
|
post :create, valid_order_attributes
|
347
347
|
assigns(:order).purchased?.should eq true
|
348
|
-
assigns(:order).payment[:details].should eq '
|
348
|
+
assigns(:order).payment[:details].should eq 'automatic purchase of free order.'
|
349
349
|
end
|
350
350
|
|
351
351
|
it 'destroys the current user cart' do
|
data/spec/dummy/log/test.log
CHANGED
@@ -205,3 +205,5 @@
|
|
205
205
|
[1m[36m (0.2ms)[0m [1mSELECT MAX("orders"."id") FROM "orders"[0m
|
206
206
|
[1m[36m (0.3ms)[0m [1mSELECT MAX("orders"."id") FROM "orders"[0m
|
207
207
|
[1m[36m (0.4ms)[0m [1mSELECT MAX("orders"."id") FROM "orders"[0m
|
208
|
+
[1m[36m (0.3ms)[0m [1mSELECT MAX("orders"."id") FROM "orders"[0m
|
209
|
+
[1m[36m (0.4ms)[0m [1mSELECT MAX("orders"."id") FROM "orders"[0m
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_orders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -380,6 +380,7 @@ files:
|
|
380
380
|
- app/views/effective/subscriptions/index.html.haml
|
381
381
|
- app/views/effective/subscriptions/new.html.haml
|
382
382
|
- app/views/effective/subscriptions/show.html.haml
|
383
|
+
- app/views/layouts/effective_orders_mailer_layout.html.haml
|
383
384
|
- config/routes.rb
|
384
385
|
- db/migrate/01_create_effective_orders.rb.erb
|
385
386
|
- db/upgrade/02_upgrade_effective_orders_from03x.rb.erb
|