effective_orders 1.5.2 → 1.5.3
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/active_admin/effective_orders.rb +19 -28
- data/app/controllers/effective/carts_controller.rb +0 -1
- data/app/controllers/effective/orders_controller.rb +0 -1
- data/app/models/concerns/acts_as_purchasable.rb +4 -0
- data/app/models/effective/order.rb +16 -0
- data/app/views/admin/customers/index.html.haml +1 -1
- data/app/views/admin/order_items/index.html.haml +1 -1
- data/app/views/admin/orders/index.html.haml +1 -1
- data/app/views/admin/orders/show.html.haml +3 -2
- data/app/views/effective/carts/show.html.haml +1 -1
- data/app/views/effective/orders/_order.html.haml +3 -0
- data/app/views/effective/orders/_order_actions.html.haml +4 -3
- data/app/views/effective/orders/_order_header.html.haml +20 -19
- data/app/views/effective/orders/_order_payment_details.html.haml +7 -9
- data/app/views/effective/orders/_order_shipping.html.haml +20 -19
- data/app/views/effective/orders/checkout.html.haml +1 -1
- data/app/views/effective/orders/declined.html.haml +1 -1
- data/app/views/effective/orders/my_purchases.html.haml +1 -1
- data/app/views/effective/orders/my_sales.html.haml +1 -1
- data/app/views/effective/orders/new.html.haml +1 -1
- data/app/views/effective/orders/purchased.html.haml +1 -1
- data/app/views/effective/orders/show.html.haml +1 -3
- data/app/views/effective/subscriptions/index.html.haml +1 -1
- data/app/views/effective/subscriptions/new.html.haml +1 -1
- data/app/views/effective/subscriptions/show.html.haml +1 -1
- data/lib/effective_orders/engine.rb +7 -3
- data/lib/effective_orders/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c08f993d24d281ba8e17af297fc43eda2d25425
|
4
|
+
data.tar.gz: 405e69619e74b45eeb3808dc31403e681666ed5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 456c396d95df8356f5db6a1985b0814955cda265c04162540ba9ac6dae48aa7b575183137ec00ae84445127d351b1673f7abc3441cd6cc0f3ebb4bd159a8bfd6
|
7
|
+
data.tar.gz: b1e31fdf1558cdf2160be96e1b289595e8f341fd2a244f35f4302061d88027d81ae2fa1828002384c89e285e9af65d4831c6ee3562b28a854f931990a8f21000
|
@@ -18,7 +18,7 @@ if defined?(ActiveAdmin)
|
|
18
18
|
include EffectiveOrdersHelper
|
19
19
|
|
20
20
|
def scoped_collection
|
21
|
-
end_of_association_chain.includes(:user).includes(:
|
21
|
+
end_of_association_chain.includes(:user).includes(order_items: :purchasable)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -33,7 +33,8 @@ if defined?(ActiveAdmin)
|
|
33
33
|
end
|
34
34
|
|
35
35
|
column 'Buyer', :sortable => :user_id do |order|
|
36
|
-
|
36
|
+
user_path = [EffectiveOrders.active_admin_namespace.presence, 'user_path'].compact.join('_')
|
37
|
+
link_to order.user, (public_send(user_path, order.user) rescue '#')
|
37
38
|
end
|
38
39
|
|
39
40
|
column 'Summary' do |order|
|
@@ -41,51 +42,41 @@ if defined?(ActiveAdmin)
|
|
41
42
|
end
|
42
43
|
|
43
44
|
column :purchased_at
|
45
|
+
column :purchase_method
|
44
46
|
|
45
47
|
column do |order|
|
46
|
-
|
47
|
-
|
48
|
-
if authorized?(:manage, Effective::Order) # This is the Admin level check
|
49
|
-
details_path = ['details', EffectiveOrders.active_admin_namespace.presence, 'order_path'].compact.join('_')
|
50
|
-
links += link_to('Details', public_send(details_path, order))
|
51
|
-
end
|
52
|
-
|
53
|
-
links
|
48
|
+
link_to('View Receipt', effective_orders.order_path(order), class: 'member_link view_link') if order.purchased?
|
54
49
|
end
|
55
|
-
end
|
56
50
|
|
57
|
-
member_action :details do
|
58
|
-
@order = Effective::Order.find(params[:id])
|
59
|
-
@page_title = "Order ##{@order.to_param} Details"
|
60
|
-
|
61
|
-
render file: 'admin/orders/show'
|
62
51
|
end
|
63
52
|
|
64
53
|
collection_action :export_csv do
|
65
54
|
@orders = Effective::Order.purchased.includes(:addresses)
|
66
55
|
|
67
56
|
col_headers = []
|
68
|
-
col_headers << "Order
|
57
|
+
col_headers << "Order"
|
58
|
+
col_headers << "Purchased at"
|
59
|
+
col_headers << "Email"
|
69
60
|
col_headers << "Full Name"
|
70
|
-
col_headers << "Purchased"
|
71
61
|
col_headers << "Subtotal"
|
72
62
|
col_headers << "Tax"
|
73
63
|
col_headers << "Total"
|
64
|
+
col_headers << 'Purchase method'
|
74
65
|
|
75
66
|
csv_string = CSV.generate do |csv|
|
76
67
|
csv << col_headers
|
77
68
|
|
78
69
|
@orders.each do |order|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
70
|
+
csv << [
|
71
|
+
order.to_param,
|
72
|
+
order.purchased_at.strftime("%Y-%m-%d %H:%M:%S %z"),
|
73
|
+
order.user.try(:email),
|
74
|
+
(order.billing_address.try(:full_name) || order.user.to_s),
|
75
|
+
(order.subtotal / 100.0).round(2),
|
76
|
+
(order.tax / 100.0).round(2),
|
77
|
+
(order.total / 100.0).round(2),
|
78
|
+
order.purchase_method
|
79
|
+
]
|
89
80
|
end
|
90
81
|
end
|
91
82
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Effective
|
2
2
|
class CartsController < ApplicationController
|
3
3
|
include EffectiveCartsHelper
|
4
|
-
acts_as_active_admin_controller('carts') if EffectiveOrders.use_active_admin?
|
5
4
|
|
6
5
|
layout (EffectiveOrders.layout.kind_of?(Hash) ? EffectiveOrders.layout[:carts] : EffectiveOrders.layout)
|
7
6
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Effective
|
2
2
|
class OrdersController < ApplicationController
|
3
3
|
include EffectiveCartsHelper
|
4
|
-
acts_as_active_admin_controller('orders') if EffectiveOrders.use_active_admin?
|
5
4
|
|
6
5
|
include Providers::Moneris if EffectiveOrders.moneris_enabled
|
7
6
|
include Providers::Paypal if EffectiveOrders.paypal_enabled
|
@@ -103,6 +103,10 @@ module ActsAsPurchasable
|
|
103
103
|
orders.select { |order| order.purchased? }
|
104
104
|
end
|
105
105
|
|
106
|
+
def purchased_order
|
107
|
+
purchased_orders.first
|
108
|
+
end
|
109
|
+
|
106
110
|
def quantity_enabled?
|
107
111
|
self.respond_to?(:quantity_enabled) ? quantity_enabled == true : false
|
108
112
|
end
|
@@ -238,6 +238,22 @@ module Effective
|
|
238
238
|
end
|
239
239
|
end
|
240
240
|
|
241
|
+
def purchase_method
|
242
|
+
if purchased?(:stripe_connect)
|
243
|
+
'Stripe Connect'
|
244
|
+
elsif purchased?(:stripe)
|
245
|
+
'Stripe'
|
246
|
+
elsif purchased?(:moneris)
|
247
|
+
'Moneris'
|
248
|
+
elsif purchased?(:paypal)
|
249
|
+
'PayPal'
|
250
|
+
elsif purchased?
|
251
|
+
'Online'
|
252
|
+
else
|
253
|
+
'None'
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
241
257
|
def purchased?(provider = nil)
|
242
258
|
return false if (purchase_state != EffectiveOrders::PURCHASED)
|
243
259
|
return true if provider == nil
|
@@ -1,2 +1,3 @@
|
|
1
|
-
=
|
2
|
-
|
1
|
+
%h2.effective-orders-page-title= (@order.purchased? ? 'Receipt' : 'Order')
|
2
|
+
|
3
|
+
= render @order
|
@@ -5,3 +5,6 @@
|
|
5
5
|
= render partial: 'effective/orders/order_header', locals: {order: order}
|
6
6
|
= render partial: 'effective/orders/order_shipping', locals: {order: order}
|
7
7
|
= render partial: 'effective/orders/order_items', locals: {order: order}
|
8
|
+
|
9
|
+
- if (EffectiveOrders.authorized?(controller, :manage, Effective::Order) rescue false)
|
10
|
+
= render partial: 'effective/orders/order_payment_details', locals: {order: order}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
- if order.purchased?
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
.effective-order-actions.pull-right
|
3
|
+
%p
|
4
|
+
= link_to 'Print', '#', :class => 'btn btn-default print-button', 'data-role' => 'print-button', :onClick => "window.print(); false;"
|
5
|
+
= link_to 'Resend Receipt', effective_orders.resend_buyer_receipt_path(order), :data => {'confirm' => 'This action will email you a copy of the original email receipt. Send receipt now?', 'disable_with' => 'Resending...'}, :class => 'btn btn-default'
|
@@ -1,21 +1,22 @@
|
|
1
|
-
|
2
|
-
.
|
3
|
-
.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
.effective-order-header
|
2
|
+
%h3 Acme Industries Inc.
|
3
|
+
.row
|
4
|
+
.col-sm-6
|
5
|
+
%p= mail_to EffectiveOrders.mailer[:admin_email] || 'info@acmeindustries.com'
|
6
|
+
%p
|
7
|
+
1234 Fake Street
|
8
|
+
%br
|
9
|
+
Edmonton, AB, T5H 4A5
|
10
|
+
%br
|
11
|
+
%small Customize me by overriding '/app/views/effective/orders/_order_header.html.haml'
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
.col-sm-6
|
14
|
+
- if order.purchased?
|
15
|
+
%p Receipt: ##{order.to_param}
|
16
|
+
- elsif order.persisted?
|
17
|
+
%p Order: ##{order.to_param}
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
- if order.purchased?
|
20
|
+
%p Purchased at: #{order.purchased_at.strftime("%Y-%m-%d %H:%M")}
|
21
|
+
- else
|
22
|
+
%p Date: #{Time.zone.now.strftime("%Y-%m-%d %H:%M")}
|
@@ -1,12 +1,10 @@
|
|
1
|
-
%h4 Payment Details
|
2
|
-
|
3
1
|
- if order.payment.present?
|
4
|
-
-
|
5
|
-
%
|
6
|
-
- elsif order.declined?
|
7
|
-
%p This order was declined with the following details:
|
2
|
+
.effective-order-payment-details
|
3
|
+
%h4 Payment Details
|
8
4
|
|
9
|
-
|
5
|
+
- if order.purchased?
|
6
|
+
%p This order was purchased with the following details:
|
7
|
+
- elsif order.declined?
|
8
|
+
%p This order was declined with the following details:
|
10
9
|
|
11
|
-
|
12
|
-
%p No payment details present
|
10
|
+
= tableize_hash(order.payment)
|
@@ -1,21 +1,22 @@
|
|
1
|
-
|
2
|
-
%
|
3
|
-
%
|
4
|
-
%
|
5
|
-
|
6
|
-
|
1
|
+
.effective-order-shipping
|
2
|
+
%table.table{:style => 'width: 600px;margin-bottom:25px;'}
|
3
|
+
%thead
|
4
|
+
%tr
|
5
|
+
%th{:style => 'text-align: left;'}= "#{order.purchased? ? 'Sold to' : 'Bill to'}"
|
6
|
+
- if order.shipping_address.present? && !order.shipping_address.empty?
|
7
|
+
%th{:style => 'text-align: left;'} Ship to
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
%td{:style => 'text-align: left;'}
|
11
|
-
- if order.billing_address.present? && !order.billing_address.empty?
|
12
|
-
= render :partial => 'effective/addresses/address', :locals => {:address => order.billing_address, :email => order.user.email}
|
13
|
-
- else
|
14
|
-
= order.billing_name
|
15
|
-
%br
|
16
|
-
= mail_to(order.user.email)
|
17
|
-
%br
|
18
|
-
|
19
|
-
- if order.shipping_address.present? && !order.shipping_address.empty?
|
9
|
+
%tbody
|
10
|
+
%tr
|
20
11
|
%td{:style => 'text-align: left;'}
|
21
|
-
|
12
|
+
- if order.billing_address.present? && !order.billing_address.empty?
|
13
|
+
= render :partial => 'effective/addresses/address', :locals => {:address => order.billing_address, :email => order.user.email}
|
14
|
+
- else
|
15
|
+
= order.billing_name
|
16
|
+
%br
|
17
|
+
= mail_to(order.user.email)
|
18
|
+
%br
|
19
|
+
|
20
|
+
- if order.shipping_address.present? && !order.shipping_address.empty?
|
21
|
+
%td{:style => 'text-align: left;'}
|
22
|
+
= render :partial => 'effective/addresses/address', :locals => {:address => order.shipping_address}
|
@@ -44,12 +44,16 @@ module EffectiveOrders
|
|
44
44
|
initializer 'effective_orders.active_admin' do
|
45
45
|
if EffectiveOrders.use_active_admin?
|
46
46
|
require 'activeadmin'
|
47
|
+
ActiveAdmin.application.load_paths.unshift Dir["#{config.root}/active_admin"]
|
47
48
|
|
48
|
-
|
49
|
-
|
49
|
+
Rails.application.config.to_prepare do
|
50
|
+
ActiveSupport.on_load :action_controller do
|
51
|
+
ApplicationController.extend(ActsAsActiveAdminController::ActionController)
|
52
|
+
Effective::OrdersController.send(:acts_as_active_admin_controller, 'orders')
|
53
|
+
Effective::CartsController.send(:acts_as_active_admin_controller, 'carts')
|
54
|
+
end
|
50
55
|
end
|
51
56
|
|
52
|
-
ActiveAdmin.application.load_paths.unshift Dir["#{config.root}/active_admin"]
|
53
57
|
end
|
54
58
|
end
|
55
59
|
|
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.5.
|
4
|
+
version: 1.5.3
|
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-10-
|
11
|
+
date: 2015-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|