effective_orders 1.4.5 → 1.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/effective/active_admin_helpers/carts.rb +47 -0
- data/app/controllers/effective/active_admin_helpers/orders.rb +47 -0
- data/app/controllers/effective/carts_controller.rb +2 -1
- data/app/controllers/effective/orders_controller.rb +1 -1
- data/lib/effective_orders/engine.rb +3 -3
- data/lib/effective_orders/version.rb +1 -1
- metadata +3 -2
- data/app/controllers/concerns/acts_as_active_admin_controller.rb +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87ba5d572d9c6252280ef318455a3c9ad73cec07
|
4
|
+
data.tar.gz: ce7b5f6096fcb1f02954573d75241e4c23fd8fb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c15b40d769f37947efb3614deaeef1b7de514737e7e009ec6476dd0e46fc5c19e668013bf8d791dba0f6f7d1b309c93f2a55933ba3b1875c70d5b3df4de24025
|
7
|
+
data.tar.gz: cfbf07a9b769fbb4d667cbae1db3e61dc3e3b54d149f943bcfc1d920e1d7070f35c5ce2e2355a27e6e47971a2b7d8fce0ca69149a3405020cb55285e15d9b44a
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Effective
|
2
|
+
module ActiveAdminHelpers
|
3
|
+
module Carts
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
include ::ActiveAdmin::BaseController::Menu
|
8
|
+
include ::ActiveAdmin::BaseController::Authorization
|
9
|
+
|
10
|
+
helper ::ActiveAdmin::ViewHelpers
|
11
|
+
helper_method :active_admin_config, :active_admin_namespace, :current_active_admin_user
|
12
|
+
helper_method :resource, :resource_path
|
13
|
+
end
|
14
|
+
|
15
|
+
module ClassMethods
|
16
|
+
end
|
17
|
+
|
18
|
+
def resource
|
19
|
+
instance_variable_get(@cart)
|
20
|
+
end
|
21
|
+
|
22
|
+
def resource_path(resource)
|
23
|
+
effective_orders.cart_path
|
24
|
+
end
|
25
|
+
|
26
|
+
def active_admin_namespace
|
27
|
+
::ActiveAdmin.application.namespaces[EffectiveOrders.active_admin_namespace || :root]
|
28
|
+
end
|
29
|
+
|
30
|
+
def active_admin_config
|
31
|
+
active_admin_namespace.resources[active_admin_resource_key]
|
32
|
+
end
|
33
|
+
|
34
|
+
def active_admin_resource_key
|
35
|
+
@active_admin_resource_key ||= begin
|
36
|
+
namespace = ::ActiveAdmin.application.namespaces[EffectiveOrders.active_admin_namespace || :root]
|
37
|
+
namespace.resources.keys.find { |resource| resource.element == 'carts' }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def current_active_admin_user
|
42
|
+
send(active_admin_namespace.current_user_method) if active_admin_namespace.current_user_method
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Effective
|
2
|
+
module ActiveAdminHelpers
|
3
|
+
module Orders
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
include ::ActiveAdmin::BaseController::Menu
|
8
|
+
include ::ActiveAdmin::BaseController::Authorization
|
9
|
+
|
10
|
+
helper ::ActiveAdmin::ViewHelpers
|
11
|
+
helper_method :active_admin_config, :active_admin_namespace, :current_active_admin_user
|
12
|
+
helper_method :resource, :resource_path
|
13
|
+
end
|
14
|
+
|
15
|
+
module ClassMethods
|
16
|
+
end
|
17
|
+
|
18
|
+
def resource
|
19
|
+
instance_variable_get(@order)
|
20
|
+
end
|
21
|
+
|
22
|
+
def resource_path(resource)
|
23
|
+
effective_orders.order_path(resource)
|
24
|
+
end
|
25
|
+
|
26
|
+
def active_admin_namespace
|
27
|
+
::ActiveAdmin.application.namespaces[EffectiveOrders.active_admin_namespace || :root]
|
28
|
+
end
|
29
|
+
|
30
|
+
def active_admin_config
|
31
|
+
active_admin_namespace.resources[active_admin_resource_key]
|
32
|
+
end
|
33
|
+
|
34
|
+
def active_admin_resource_key
|
35
|
+
@active_admin_resource_key ||= begin
|
36
|
+
namespace = ::ActiveAdmin.application.namespaces[EffectiveOrders.active_admin_namespace || :root]
|
37
|
+
namespace.resources.keys.find { |resource| resource.element == 'orders' }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def current_active_admin_user
|
42
|
+
send(active_admin_namespace.current_user_method) if active_admin_namespace.current_user_method
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Effective
|
2
2
|
class CartsController < ApplicationController
|
3
3
|
include EffectiveCartsHelper
|
4
|
-
|
4
|
+
include ActiveAdminHelpers::Carts if EffectiveOrders.use_active_admin
|
5
|
+
|
5
6
|
layout (EffectiveOrders.layout.kind_of?(Hash) ? EffectiveOrders.layout[:carts] : EffectiveOrders.layout)
|
6
7
|
|
7
8
|
def show
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Effective
|
2
2
|
class OrdersController < ApplicationController
|
3
3
|
include EffectiveCartsHelper
|
4
|
-
|
4
|
+
include ActiveAdminHelpers::Orders if EffectiveOrders.use_active_admin
|
5
5
|
|
6
6
|
include Providers::Moneris if EffectiveOrders.moneris_enabled
|
7
7
|
include Providers::Paypal if EffectiveOrders.paypal_enabled
|
@@ -43,9 +43,9 @@ module EffectiveOrders
|
|
43
43
|
# ActiveAdmin (optional)
|
44
44
|
# This prepends the load path so someone can override the assets.rb if they want.
|
45
45
|
initializer 'effective_orders.active_admin' do
|
46
|
-
if
|
47
|
-
|
48
|
-
ActiveAdmin.application.load_paths.unshift Dir["#{config.root}/active_admin"]
|
46
|
+
if EffectiveOrders.use_active_admin
|
47
|
+
require 'active_admin'
|
48
|
+
::ActiveAdmin.application.load_paths.unshift Dir["#{config.root}/active_admin"]
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_orders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
@@ -325,7 +325,8 @@ files:
|
|
325
325
|
- app/controllers/admin/customers_controller.rb
|
326
326
|
- app/controllers/admin/order_items_controller.rb
|
327
327
|
- app/controllers/admin/orders_controller.rb
|
328
|
-
- app/controllers/
|
328
|
+
- app/controllers/effective/active_admin_helpers/carts.rb
|
329
|
+
- app/controllers/effective/active_admin_helpers/orders.rb
|
329
330
|
- app/controllers/effective/carts_controller.rb
|
330
331
|
- app/controllers/effective/orders_controller.rb
|
331
332
|
- app/controllers/effective/providers/moneris.rb
|
@@ -1,60 +0,0 @@
|
|
1
|
-
module ActsAsActiveAdminController
|
2
|
-
extend ActiveSupport::Concern
|
3
|
-
|
4
|
-
module ActionController
|
5
|
-
def acts_as_active_admin_controller(key)
|
6
|
-
puts "== acts_as_active_admin_controller(#{key})"
|
7
|
-
@active_admin_resource_element_lookup_key = key
|
8
|
-
include ::ActsAsActiveAdminController
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
included do
|
13
|
-
include ::ActiveAdmin::BaseController::Menu
|
14
|
-
include ::ActiveAdmin::BaseController::Authorization
|
15
|
-
|
16
|
-
helper ::ActiveAdmin::ViewHelpers
|
17
|
-
helper_method :active_admin_config, :active_admin_namespace, :current_active_admin_user
|
18
|
-
|
19
|
-
resource_key = @active_admin_resource_element_lookup_key.to_s
|
20
|
-
self.send(:define_method, :active_admin_resource_element_key) { resource_key }
|
21
|
-
|
22
|
-
resource_ivar = '@' + resource_key.singularize
|
23
|
-
self.send(:define_method, :resource) { instance_variable_get(resource_ivar) }
|
24
|
-
|
25
|
-
resource_path = "effective_orders.#{resource_key.singularize}_path"
|
26
|
-
|
27
|
-
if resource_path == 'effective_orders.cart_path'
|
28
|
-
self.send(:define_method, :resource_path) { |resource| effective_orders.cart_path }
|
29
|
-
else
|
30
|
-
self.send(:define_method, :resource_path) { |resource| public_send(resource_path, resource) }
|
31
|
-
end
|
32
|
-
|
33
|
-
helper_method :resource, :resource_path
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
module ClassMethods
|
38
|
-
end
|
39
|
-
|
40
|
-
def active_admin_namespace
|
41
|
-
ActiveAdmin.application.namespaces[EffectiveOrders.active_admin_namespace || :root]
|
42
|
-
end
|
43
|
-
|
44
|
-
def active_admin_config
|
45
|
-
active_admin_namespace.resources[active_admin_resource_key]
|
46
|
-
end
|
47
|
-
|
48
|
-
def active_admin_resource_key
|
49
|
-
@active_admin_resource_key ||= begin
|
50
|
-
namespace = ActiveAdmin.application.namespaces[EffectiveOrders.active_admin_namespace || :root]
|
51
|
-
namespace.resources.keys.find { |resource| resource.element == active_admin_resource_element_key }
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def current_active_admin_user
|
56
|
-
send(active_admin_namespace.current_user_method) if active_admin_namespace.current_user_method
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|