radiant-shop-extension 0.90.0 → 0.90.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +6 -6
- data/VERSION +1 -1
- data/app/.DS_Store +0 -0
- data/app/controllers/admin/shop/categories_controller.rb +3 -3
- data/app/controllers/admin/shop/customers_controller.rb +2 -1
- data/app/controllers/admin/shop/orders_controller.rb +1 -0
- data/app/models/form_checkout.rb +65 -45
- data/app/models/shop_product_attachment.rb +2 -0
- data/app/views/.DS_Store +0 -0
- data/app/views/admin/.DS_Store +0 -0
- data/app/views/admin/shop/customers/index/_foot.html.haml +6 -4
- data/app/views/admin/shop/orders/index/_foot.html.haml +6 -4
- data/lib/radiant-shop-extension.rb +1 -0
- data/lib/shop/interface/customers.rb +1 -1
- data/lib/shop/interface/orders.rb +1 -1
- data/lib/shop/tags/card.rb +5 -5
- data/public/stylesheets/sass/admin/extensions/shop/index.sass +3 -1
- data/radiant-shop-extension.gemspec +266 -269
- data/shop_extension.rb +19 -26
- data/spec/controllers/admin/shop/categories_controller_spec.rb +1 -1
- data/spec/controllers/admin/shop/customers_controller_spec.rb +1 -1
- data/spec/controllers/admin/shop/orders_controller_spec.rb +1 -1
- data/spec/controllers/admin/shop/products/images_controller_spec.rb +1 -1
- data/spec/controllers/admin/shop/products_controller_spec.rb +1 -1
- data/spec/controllers/admin/shops_controller_spec.rb +1 -1
- data/spec/lib/shop/models/image_spec.rb +1 -1
- data/spec/lib/shop/models/page_spec.rb +1 -1
- data/spec/lib/shop/tags/address_spec.rb +1 -1
- data/spec/lib/shop/tags/card_spec.rb +4 -5
- data/spec/lib/shop/tags/cart_spec.rb +1 -2
- data/spec/lib/shop/tags/category_spec.rb +1 -1
- data/spec/lib/shop/tags/core_spec.rb +1 -1
- data/spec/lib/shop/tags/helpers_spec.rb +1 -1
- data/spec/lib/shop/tags/item_spec.rb +1 -1
- data/spec/lib/shop/tags/product_spec.rb +1 -1
- data/spec/lib/shop/tags/tax_spec.rb +1 -1
- data/spec/models/form_address_spec.rb +1 -1
- data/spec/models/form_checkout_spec.rb +39 -32
- data/spec/models/shop_address_spec.rb +1 -1
- data/spec/models/shop_category_page_spec.rb +1 -1
- data/spec/models/shop_category_spec.rb +1 -1
- data/spec/models/shop_customer_spec.rb +1 -1
- data/spec/models/shop_line_item_spec.rb +1 -1
- data/spec/models/shop_order_spec.rb +1 -1
- data/spec/models/shop_payment_spec.rb +1 -1
- data/spec/models/shop_product_attachment_spec.rb +1 -1
- data/spec/models/shop_product_page_spec.rb +1 -1
- data/spec/models/shop_product_spec.rb +1 -1
- metadata +46 -35
- data/.gitignore +0 -6
- data/config/shop_cart.yml +0 -16
- data/vendor/plugins/acts_as_list/README +0 -23
- data/vendor/plugins/acts_as_list/init.rb +0 -3
- data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +0 -256
- data/vendor/plugins/acts_as_list/test/list_test.rb +0 -332
data/shop_extension.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
class ShopExtension < Radiant::Extension
|
2
|
-
version
|
3
|
-
description "
|
4
|
-
url "http://github.com/
|
2
|
+
version YAML::load_file(File.join(File.dirname(__FILE__), 'VERSION'))
|
3
|
+
description "Radiant Shop provides"
|
4
|
+
url "http://github.com/dirkkelly/radiant-shop-extension"
|
5
5
|
|
6
6
|
extension_config do |config|
|
7
7
|
config.gem 'activemerchant', :lib => 'active_merchant'
|
8
8
|
config.gem 'fastercsv', :lib => 'fastercsv'
|
9
9
|
config.gem 'radiant-settings-extension', :lib => false
|
10
|
-
config.gem 'radiant-users-extension'
|
11
|
-
config.gem 'radiant-images-extension'
|
12
|
-
config.gem 'radiant-forms-extension'
|
13
|
-
config.gem 'radiant-
|
10
|
+
config.gem 'radiant-users-extension'
|
11
|
+
config.gem 'radiant-images-extension'
|
12
|
+
config.gem 'radiant-forms-extension'
|
13
|
+
config.gem 'radiant-drag_order-extension'
|
14
14
|
end
|
15
15
|
|
16
16
|
UserActionObserver.instance.send :add_observer!, ShopCategory
|
@@ -18,8 +18,13 @@ class ShopExtension < Radiant::Extension
|
|
18
18
|
UserActionObserver.instance.send :add_observer!, ShopProduct
|
19
19
|
UserActionObserver.instance.send :add_observer!, ShopProductAttachment
|
20
20
|
|
21
|
-
def activate
|
22
|
-
|
21
|
+
def activate
|
22
|
+
tab "Shop" do
|
23
|
+
add_item "Products", "/admin/shop"
|
24
|
+
add_item "Orders", "/admin/shop/orders"
|
25
|
+
add_item "Customers", "/admin/shop/customers"
|
26
|
+
end
|
27
|
+
|
23
28
|
unless defined? admin.products
|
24
29
|
Radiant::AdminUI.send :include, Shop::Interface::Categories, Shop::Interface::Customers
|
25
30
|
Radiant::AdminUI.send :include, Shop::Interface::Discounts, Shop::Interface::Orders, Shop::Interface::Products
|
@@ -31,28 +36,16 @@ class ShopExtension < Radiant::Extension
|
|
31
36
|
admin.products = Radiant::AdminUI.load_default_shop_products_regions
|
32
37
|
end
|
33
38
|
|
34
|
-
# Tags
|
35
|
-
Page.send :include, Shop::Tags::Core, Shop::Tags::Address, Shop::Tags::Card, Shop::Tags::Cart
|
36
|
-
Page.send :include, Shop::Tags::Category, Shop::Tags::Item, Shop::Tags::Product
|
37
|
-
Page.send :include, Shop::Tags::Tax
|
38
|
-
|
39
|
-
# Model Includes
|
40
39
|
Page.send :include, Shop::Models::Page
|
41
40
|
Image.send :include, Shop::Models::Image
|
42
41
|
User.send :include, Shop::Models::User
|
43
42
|
|
44
|
-
# Controller Includes
|
45
43
|
ApplicationController.send :include, Shop::Controllers::ApplicationController
|
46
44
|
SiteController.send :include, Shop::Controllers::SiteController
|
47
45
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
add_item "Orders", "/admin/shop/orders"
|
52
|
-
add_item "Customers", "/admin/shop/customers"
|
53
|
-
end
|
54
|
-
|
55
|
-
Radiant::Config['shop.root_page_id'] ||= nil
|
46
|
+
Page.send :include, Shop::Tags::Core, Shop::Tags::Address, Shop::Tags::Card, Shop::Tags::Cart
|
47
|
+
Page.send :include, Shop::Tags::Category, Shop::Tags::Item, Shop::Tags::Product
|
48
|
+
Page.send :include, Shop::Tags::Tax
|
56
49
|
|
57
50
|
Radiant::Config['shop.layout_product'] ||= 'Product'
|
58
51
|
Radiant::Config['shop.layout_category'] ||= 'Products'
|
@@ -68,8 +61,8 @@ class ShopExtension < Radiant::Extension
|
|
68
61
|
|
69
62
|
Radiant::Config['shop.date_format'] ||= '%d/%m/%Y'
|
70
63
|
|
71
|
-
|
72
|
-
|
64
|
+
Radiant::Config['users.customer.redirect'] = '/cart'
|
65
|
+
|
73
66
|
end
|
74
67
|
|
75
68
|
end
|
@@ -1,5 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require 'spec/helpers/nested_tag_helper'
|
1
|
+
require File.dirname(__FILE__) + "/../../../spec_helper"
|
3
2
|
|
4
3
|
#
|
5
4
|
# Test for Shop Line Item Tags
|
@@ -27,7 +26,7 @@ describe Shop::Tags::Card do
|
|
27
26
|
exp = %{<select name="card[type]" id="card_type">
|
28
27
|
<option value="amex">American Express</option>
|
29
28
|
<option value="diners">Diners Club</option>
|
30
|
-
<option value="
|
29
|
+
<option value="master">Master Card</option>
|
31
30
|
<option value="visa">Visa</option>
|
32
31
|
</select>}
|
33
32
|
|
@@ -39,7 +38,7 @@ describe Shop::Tags::Card do
|
|
39
38
|
it 'should output all except amex and diners' do
|
40
39
|
tag = %{<r:form:card:type except="amex,diners" />}
|
41
40
|
exp = %{<select name="card[type]" id="card_type">
|
42
|
-
<option value="
|
41
|
+
<option value="master">Master Card</option>
|
43
42
|
<option value="visa">Visa</option>
|
44
43
|
</select>}
|
45
44
|
|
@@ -86,7 +85,7 @@ describe Shop::Tags::Card do
|
|
86
85
|
it 'should output the card years' do
|
87
86
|
tag = %{<r:form:card:year />}
|
88
87
|
exp = %{<select name="card[year]" id="card_year">\n}
|
89
|
-
(Time.new.year ... Time.new.year +
|
88
|
+
(Time.new.year ... Time.new.year + 15).each do |year|
|
90
89
|
exp << %{<option value="#{year}">#{year}</option>\n}
|
91
90
|
end
|
92
91
|
exp << %{</select>}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require File.dirname(__FILE__) + "/../spec_helper"
|
2
2
|
|
3
3
|
describe FormCheckout do
|
4
4
|
|
@@ -9,25 +9,7 @@ describe FormCheckout do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
describe '#create' do
|
12
|
-
context 'gateway' do
|
13
|
-
context 'order has no billing' do
|
14
|
-
before :each do
|
15
|
-
login_as :customer
|
16
|
-
@order = shop_orders(:empty)
|
17
|
-
mock_valid_form_checkout_request
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should return the standard response' do
|
21
|
-
@checkout = FormCheckout.new(@form, @page, @form[:extensions][:bogus_checkout])
|
22
|
-
result = @checkout.create
|
23
|
-
|
24
|
-
result[:gateway].should be_nil
|
25
|
-
result[:payment].should be_nil
|
26
|
-
result[:card].should be_nil
|
27
|
-
result[:message].should be_nil
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
12
|
+
context 'gateway' do
|
31
13
|
context 'configured correctly' do
|
32
14
|
before :each do
|
33
15
|
login_as :customer
|
@@ -48,9 +30,10 @@ describe FormCheckout do
|
|
48
30
|
@checkout = FormCheckout.new(@form, @page, @form[:extensions][:bogus_checkout])
|
49
31
|
result = @checkout.create
|
50
32
|
|
51
|
-
result[:gateway].should
|
52
|
-
result[:card].should
|
53
|
-
result[:payment].should
|
33
|
+
result[:gateway].should be_true
|
34
|
+
result[:card].should be_true
|
35
|
+
result[:payment].should be_true
|
36
|
+
result[:message].should === "Order successfully processed"
|
54
37
|
end
|
55
38
|
|
56
39
|
it 'should assign a payment object' do
|
@@ -70,6 +53,24 @@ describe FormCheckout do
|
|
70
53
|
end
|
71
54
|
end
|
72
55
|
|
56
|
+
context 'no billing address sent' do
|
57
|
+
before :each do
|
58
|
+
login_as :customer
|
59
|
+
@order = shop_orders(:empty)
|
60
|
+
mock_valid_form_checkout_request
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should return the standard response' do
|
64
|
+
@checkout = FormCheckout.new(@form, @page, @form[:extensions][:bogus_checkout])
|
65
|
+
result = @checkout.create
|
66
|
+
|
67
|
+
result[:gateway].should be_nil
|
68
|
+
result[:payment].should be_nil
|
69
|
+
result[:card].should be_nil
|
70
|
+
result[:message].should === "Billing Address has not been set"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
73
74
|
context 'configured incorrectly' do
|
74
75
|
before :each do
|
75
76
|
login_as :customer
|
@@ -84,11 +85,12 @@ describe FormCheckout do
|
|
84
85
|
@checkout = FormCheckout.new(@form, @page, @form[:extensions][:bogus_checkout])
|
85
86
|
result = @checkout.create
|
86
87
|
|
87
|
-
result[:gateway].should
|
88
|
+
result[:gateway].should be_false
|
88
89
|
result[:card].should be_nil
|
89
90
|
result[:payment].should be_nil
|
91
|
+
result[:message].should === "Payment gateway has not been configured"
|
90
92
|
|
91
|
-
@order.payment.should
|
93
|
+
@order.payment.should be_nil
|
92
94
|
end
|
93
95
|
end
|
94
96
|
|
@@ -99,32 +101,37 @@ describe FormCheckout do
|
|
99
101
|
@checkout = FormCheckout.new(@form, @page, @form[:extensions][:bogus_checkout])
|
100
102
|
result = @checkout.create
|
101
103
|
|
102
|
-
result[:gateway].should
|
104
|
+
result[:gateway].should be_true
|
103
105
|
result[:card].should be_nil
|
104
106
|
result[:payment].should be_nil
|
107
|
+
result[:message].should === "Credit card details were not sent"
|
105
108
|
|
106
|
-
@order.payment.should
|
109
|
+
@order.payment.should be_nil
|
107
110
|
end
|
108
111
|
end
|
109
112
|
|
110
113
|
context 'invalid card' do
|
111
114
|
it 'should return card and payment false' do
|
112
|
-
|
115
|
+
@card = ActiveMerchant::Billing::CreditCard.new
|
116
|
+
stub(@card).valid? { false }
|
117
|
+
|
118
|
+
mock.instance_of(ActiveMerchant::Billing::CreditCard) { @card }
|
113
119
|
|
114
120
|
@checkout = FormCheckout.new(@form, @page, @form[:extensions][:bogus_checkout])
|
115
121
|
result = @checkout.create
|
116
122
|
|
117
|
-
result[:gateway].should
|
118
|
-
result[:card].should
|
123
|
+
result[:gateway].should be_true
|
124
|
+
result[:card].should be_false
|
119
125
|
result[:payment].should be_nil
|
126
|
+
result[:message].should === "Type is not the correct card type"
|
120
127
|
|
121
|
-
@order.payment.should
|
128
|
+
@order.payment.should be_nil
|
122
129
|
end
|
123
130
|
end
|
124
131
|
end
|
125
132
|
end
|
126
133
|
|
127
|
-
context '
|
134
|
+
context 'result_extension' do
|
128
135
|
before :each do
|
129
136
|
mock.instance_of(ActiveMerchant::Billing::CreditCard).valid? { true }
|
130
137
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-shop-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 373
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 90
|
9
|
-
-
|
10
|
-
version: 0.90.
|
9
|
+
- 1
|
10
|
+
version: 0.90.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dirk Kelly
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-11-
|
20
|
+
date: 2010-11-24 00:00:00 +08:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -72,6 +72,22 @@ dependencies:
|
|
72
72
|
type: :runtime
|
73
73
|
prerelease: false
|
74
74
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 31
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
- 1
|
83
|
+
- 2
|
84
|
+
version: 0.1.2
|
85
|
+
name: acts_as_list
|
86
|
+
requirement: *id004
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
75
91
|
none: false
|
76
92
|
requirements:
|
77
93
|
- - ">="
|
@@ -83,71 +99,71 @@ dependencies:
|
|
83
99
|
- 1
|
84
100
|
version: 1.1.1
|
85
101
|
name: radiant-settings-extension
|
86
|
-
requirement: *
|
102
|
+
requirement: *id005
|
87
103
|
- !ruby/object:Gem::Dependency
|
88
104
|
type: :runtime
|
89
105
|
prerelease: false
|
90
|
-
version_requirements: &
|
106
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
91
107
|
none: false
|
92
108
|
requirements:
|
93
109
|
- - ">="
|
94
110
|
- !ruby/object:Gem::Version
|
95
|
-
hash:
|
111
|
+
hash: 13
|
96
112
|
segments:
|
97
113
|
- 0
|
98
114
|
- 4
|
99
|
-
-
|
100
|
-
version: 0.4.
|
115
|
+
- 1
|
116
|
+
version: 0.4.1
|
101
117
|
name: radiant-images-extension
|
102
|
-
requirement: *
|
118
|
+
requirement: *id006
|
103
119
|
- !ruby/object:Gem::Dependency
|
104
120
|
type: :runtime
|
105
121
|
prerelease: false
|
106
|
-
version_requirements: &
|
122
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
107
123
|
none: false
|
108
124
|
requirements:
|
109
125
|
- - ">="
|
110
126
|
- !ruby/object:Gem::Version
|
111
|
-
hash:
|
127
|
+
hash: 3
|
112
128
|
segments:
|
113
129
|
- 3
|
114
130
|
- 2
|
115
|
-
-
|
116
|
-
version: 3.2.
|
131
|
+
- 6
|
132
|
+
version: 3.2.6
|
117
133
|
name: radiant-forms-extension
|
118
|
-
requirement: *
|
134
|
+
requirement: *id007
|
119
135
|
- !ruby/object:Gem::Dependency
|
120
136
|
type: :runtime
|
121
137
|
prerelease: false
|
122
|
-
version_requirements: &
|
138
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
123
139
|
none: false
|
124
140
|
requirements:
|
125
141
|
- - ">="
|
126
142
|
- !ruby/object:Gem::Version
|
127
|
-
hash:
|
143
|
+
hash: 27
|
128
144
|
segments:
|
129
145
|
- 0
|
130
146
|
- 0
|
131
|
-
-
|
132
|
-
version: 0.0.
|
147
|
+
- 2
|
148
|
+
version: 0.0.2
|
133
149
|
name: radiant-users-extension
|
134
|
-
requirement: *
|
150
|
+
requirement: *id008
|
135
151
|
- !ruby/object:Gem::Dependency
|
136
152
|
type: :runtime
|
137
153
|
prerelease: false
|
138
|
-
version_requirements: &
|
154
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
139
155
|
none: false
|
140
156
|
requirements:
|
141
157
|
- - ">="
|
142
158
|
- !ruby/object:Gem::Version
|
143
|
-
hash:
|
159
|
+
hash: 3
|
144
160
|
segments:
|
145
161
|
- 0
|
146
|
-
-
|
147
|
-
-
|
148
|
-
version: 0.
|
149
|
-
name: radiant-
|
150
|
-
requirement: *
|
162
|
+
- 3
|
163
|
+
- 8
|
164
|
+
version: 0.3.8
|
165
|
+
name: radiant-drag_order-extension
|
166
|
+
requirement: *id009
|
151
167
|
description: Radiant Shop is an attempt at a simple but complete store. It includes Products, Categories, Orders and Credit Card Payments
|
152
168
|
email: dk@dirkkelly.com
|
153
169
|
executables: []
|
@@ -158,7 +174,6 @@ extra_rdoc_files:
|
|
158
174
|
- LICENSE
|
159
175
|
- README.md
|
160
176
|
files:
|
161
|
-
- .gitignore
|
162
177
|
- HISTORY.md
|
163
178
|
- LICENSE
|
164
179
|
- README.md
|
@@ -279,7 +294,6 @@ files:
|
|
279
294
|
- app/views/admin/shop/products/remove.html.haml
|
280
295
|
- config/locales/en.yml
|
281
296
|
- config/routes.rb
|
282
|
-
- config/shop_cart.yml
|
283
297
|
- db/migrate/20101011063133_setup_shop.rb
|
284
298
|
- db/seed.rb
|
285
299
|
- db/seeds/forms.rb
|
@@ -287,6 +301,7 @@ files:
|
|
287
301
|
- db/seeds/pages.rb
|
288
302
|
- db/seeds/products.rb
|
289
303
|
- db/seeds/snippets.rb
|
304
|
+
- lib/radiant-shop-extension.rb
|
290
305
|
- lib/shop/controllers/application_controller.rb
|
291
306
|
- lib/shop/controllers/site_controller.rb
|
292
307
|
- lib/shop/interface/categories.rb
|
@@ -363,17 +378,13 @@ files:
|
|
363
378
|
- spec/models/shop_product_spec.rb
|
364
379
|
- spec/spec.opts
|
365
380
|
- spec/spec_helper.rb
|
366
|
-
- vendor/plugins/acts_as_list/README
|
367
|
-
- vendor/plugins/acts_as_list/init.rb
|
368
|
-
- vendor/plugins/acts_as_list/lib/active_record/acts/list.rb
|
369
|
-
- vendor/plugins/acts_as_list/test/list_test.rb
|
370
381
|
has_rdoc: true
|
371
382
|
homepage: http://github.com/squaretalent/radiant-shop-extension
|
372
383
|
licenses: []
|
373
384
|
|
374
385
|
post_install_message:
|
375
|
-
rdoc_options:
|
376
|
-
|
386
|
+
rdoc_options: []
|
387
|
+
|
377
388
|
require_paths:
|
378
389
|
- lib
|
379
390
|
required_ruby_version: !ruby/object:Gem::Requirement
|