spree_core 1.1.6 → 1.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/images/{creditcards → credit_cards}/amex_cid.gif +0 -0
- data/app/assets/images/{creditcards/creditcard.gif → credit_cards/credit_card.gif} +0 -0
- data/app/assets/images/{creditcards → credit_cards}/discover_cid.gif +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/american_express.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/cirrus.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/delta.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/dinersclub.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/directdebit.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/discover.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/egold.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/maestro.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/master.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/paypal.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/solo.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/switch.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/visa.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/visaelectron.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/westernunion.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/wirecard.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/worldpay.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/master_cid.jpg +0 -0
- data/app/assets/images/{creditcards → credit_cards}/visa_cid.gif +0 -0
- data/app/assets/javascripts/admin/admin.js.erb +12 -136
- data/app/assets/javascripts/admin/checkouts/edit.js +18 -35
- data/app/assets/javascripts/admin/gateway.js +2 -2
- data/app/assets/javascripts/admin/images/index.js.coffee +12 -0
- data/app/assets/javascripts/admin/images/new.js.coffee +4 -0
- data/app/assets/javascripts/admin/orders/edit.js +1 -1
- data/app/assets/javascripts/admin/orders/edit_form.js +0 -2
- data/app/assets/javascripts/admin/product_autocomplete.js.erb +116 -0
- data/app/assets/javascripts/store/cart.js.coffee +7 -0
- data/app/assets/javascripts/store/checkout.js.coffee +57 -0
- data/app/assets/javascripts/store/product.js.coffee +36 -0
- data/app/assets/stylesheets/admin/admin.css.erb +5 -0
- data/app/assets/stylesheets/admin/spree_core.css +1 -0
- data/app/assets/stylesheets/store/screen.css.scss +15 -1
- data/app/assets/stylesheets/store/variables.css.scss +29 -29
- data/app/controllers/spree/admin/banners_controller.rb +14 -0
- data/app/controllers/spree/admin/base_controller.rb +11 -0
- data/app/controllers/spree/admin/images_controller.rb +13 -5
- data/app/controllers/spree/admin/line_items_controller.rb +16 -25
- data/app/controllers/spree/admin/mail_methods_controller.rb +1 -8
- data/app/controllers/spree/admin/option_types_controller.rb +0 -25
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +3 -3
- data/app/controllers/spree/admin/orders_controller.rb +23 -14
- data/app/controllers/spree/admin/payment_methods_controller.rb +1 -7
- data/app/controllers/spree/admin/payments_controller.rb +5 -5
- data/app/controllers/spree/admin/products_controller.rb +15 -5
- data/app/controllers/spree/admin/prototypes_controller.rb +2 -2
- data/app/controllers/spree/admin/reports_controller.rb +1 -7
- data/app/controllers/spree/admin/resource_controller.rb +130 -130
- data/app/controllers/spree/admin/search_controller.rb +47 -0
- data/app/controllers/spree/admin/taxons_controller.rb +0 -43
- data/app/controllers/spree/base_controller.rb +2 -1
- data/app/controllers/spree/checkout_controller.rb +29 -10
- data/app/controllers/spree/orders_controller.rb +7 -11
- data/app/controllers/spree/products_controller.rb +5 -1
- data/app/helpers/spree/account_helper.rb +4 -0
- data/app/helpers/spree/admin/base_helper.rb +2 -44
- data/app/helpers/spree/admin/navigation_helper.rb +1 -3
- data/app/helpers/spree/admin/orders_helper.rb +3 -2
- data/app/helpers/spree/admin/products_helper.rb +21 -0
- data/app/helpers/spree/base_helper.rb +14 -11
- data/app/helpers/spree/checkout_helper.rb +5 -1
- data/app/helpers/spree/orders_helper.rb +5 -0
- data/app/helpers/spree/products_helper.rb +4 -0
- data/app/helpers/spree/trackers_helper.rb +4 -0
- data/app/models/spree/ability.rb +70 -0
- data/app/models/spree/address.rb +4 -12
- data/app/models/spree/adjustment.rb +30 -8
- data/app/models/spree/app_configuration.rb +1 -1
- data/app/models/spree/calculator/price_sack.rb +3 -5
- data/app/models/spree/country.rb +1 -4
- data/app/models/spree/{creditcard.rb → credit_card.rb} +4 -4
- data/app/models/spree/gateway.rb +2 -2
- data/app/models/spree/gateway/bogus.rb +10 -10
- data/app/models/spree/gateway/bogus_simple.rb +4 -4
- data/app/models/spree/image.rb +3 -12
- data/app/models/spree/inventory_unit.rb +4 -6
- data/app/models/spree/{user.rb → legacy_user.rb} +7 -6
- data/app/models/spree/line_item.rb +4 -5
- data/app/models/spree/option_type.rb +4 -6
- data/app/models/spree/option_value.rb +1 -1
- data/app/models/spree/order.rb +90 -132
- data/app/models/spree/order/checkout.rb +124 -0
- data/app/models/spree/payment.rb +6 -6
- data/app/models/spree/payment/processing.rb +34 -38
- data/app/models/spree/payment_method.rb +2 -2
- data/app/models/spree/preference.rb +2 -0
- data/app/models/spree/preferences/preferable_class_methods.rb +0 -2
- data/app/models/spree/preferences/store.rb +3 -21
- data/app/models/spree/product.rb +41 -43
- data/app/models/spree/product/scopes.rb +9 -25
- data/app/models/spree/product_option_type.rb +2 -2
- data/app/models/spree/product_property.rb +9 -4
- data/app/models/spree/property.rb +1 -1
- data/app/models/spree/prototype.rb +2 -2
- data/app/models/spree/return_authorization.rb +2 -2
- data/app/models/spree/role.rb +1 -1
- data/app/models/spree/shipment.rb +6 -5
- data/app/models/spree/shipping_method.rb +19 -13
- data/app/models/spree/state.rb +2 -5
- data/app/models/spree/state_change.rb +1 -1
- data/app/models/spree/tax_rate.rb +8 -1
- data/app/models/spree/taxon.rb +5 -1
- data/app/models/spree/taxonomy.rb +1 -1
- data/app/models/spree/tokenized_permission.rb +6 -0
- data/app/models/spree/tracker.rb +1 -1
- data/app/models/spree/variant.rb +13 -40
- data/app/models/spree/zone.rb +15 -14
- data/app/models/spree/zone_member.rb +1 -1
- data/app/views/spree/admin/image_settings/edit.html.erb +2 -2
- data/app/views/spree/admin/images/_form.html.erb +8 -4
- data/app/views/spree/admin/images/index.html.erb +1 -1
- data/app/views/spree/admin/line_items/create.js.erb +1 -1
- data/app/views/spree/admin/option_types/_option_value_fields.html.erb +1 -1
- data/app/views/spree/admin/option_types/index.html.erb +1 -1
- data/app/views/spree/admin/orders/_add_product.html.erb +1 -1
- data/app/views/spree/admin/orders/customer_details/edit.html.erb +1 -1
- data/app/views/spree/admin/orders/index.html.erb +4 -4
- data/app/views/spree/admin/orders/show.html.erb +1 -1
- data/app/views/spree/admin/payments/_form.html.erb +1 -1
- data/app/views/spree/admin/payments/new.html.erb +0 -4
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +1 -1
- data/app/views/spree/admin/payments/source_views/_gateway.html.erb +2 -2
- data/app/views/spree/admin/products/_form.html.erb +21 -5
- data/app/views/spree/admin/products/index.html.erb +2 -2
- data/app/views/spree/admin/properties/_form.html.erb +1 -1
- data/app/views/spree/admin/properties/index.html.erb +1 -1
- data/app/views/spree/admin/return_authorizations/_form.html.erb +33 -17
- data/app/views/spree/admin/return_authorizations/edit.html.erb +2 -2
- data/app/views/spree/admin/shared/_address_form.html.erb +1 -1
- data/app/views/spree/admin/shared/_head.html.erb +12 -2
- data/app/views/spree/admin/shared/_order_tabs.html.erb +1 -4
- data/app/views/spree/admin/shared/_product_tabs.html.erb +0 -6
- data/app/views/spree/admin/shared/_show_resource_links.html.erb +3 -3
- data/app/views/spree/admin/shared/_tabs.html.erb +1 -2
- data/app/views/spree/admin/shipments/edit.html.erb +2 -2
- data/app/views/spree/admin/shipping_methods/_form.html.erb +1 -1
- data/app/views/spree/admin/states/_state_list.html.erb +1 -1
- data/app/views/spree/admin/tax_rates/index.html.erb +1 -1
- data/app/views/spree/admin/taxonomies/_form.html.erb +1 -1
- data/app/views/spree/admin/taxons/_form.html.erb +1 -1
- data/app/views/spree/admin/taxons/_taxon_table.html.erb +2 -2
- data/app/views/spree/admin/variants/_form.html.erb +13 -13
- data/app/views/spree/admin/variants/index.html.erb +1 -7
- data/app/views/spree/checkout/_address.html.erb +10 -4
- data/app/views/spree/checkout/edit.html.erb +0 -1
- data/app/views/spree/checkout/payment/_gateway.html.erb +5 -5
- data/app/views/spree/checkout/registration.html.erb +2 -2
- data/app/views/spree/content/cvv.html.erb +6 -6
- data/app/views/spree/layouts/spree_application.html.erb +4 -48
- data/app/views/spree/order_mailer/cancel_email.text.erb +5 -5
- data/app/views/spree/order_mailer/confirm_email.text.erb +6 -7
- data/app/views/spree/orders/_adjustments.html.erb +14 -0
- data/app/views/spree/orders/_form.html.erb +1 -0
- data/app/views/spree/orders/show.html.erb +3 -3
- data/app/views/spree/products/_thumbnails.html.erb +1 -1
- data/app/views/spree/products/index.html.erb +1 -1
- data/app/views/spree/shared/_footer.html.erb +6 -0
- data/app/views/spree/shared/_google_analytics.html.erb +15 -16
- data/app/views/spree/shared/_head.html.erb +3 -9
- data/app/views/spree/shared/_header.html.erb +5 -0
- data/app/views/spree/shared/_main_nav_bar.html.erb +6 -0
- data/app/views/spree/shared/_nav_bar.html.erb +7 -3
- data/app/views/spree/shared/_order_details.html.erb +14 -11
- data/app/views/spree/shared/_sidebar.html.erb +3 -0
- data/app/views/spree/shared/unauthorized.html.erb +0 -0
- data/app/views/spree/shipment_mailer/shipped_email.text.erb +7 -7
- data/app/views/spree/taxons/show.html.erb +1 -1
- data/config/initializers/check_for_orphaned_preferences.rb +1 -1
- data/config/initializers/spree.rb +0 -12
- data/config/initializers/user_class_extensions.rb +25 -0
- data/config/initializers/workarounds_for_ruby19.rb +72 -0
- data/config/locales/en.yml +11 -24
- data/config/routes.rb +7 -37
- data/db/migrate/20090823005402_spree_zero_nine_zero.rb +14 -12
- data/db/migrate/20091015153048_add_openid_field_to_users.rb +9 -7
- data/db/migrate/20100209144531_polymorphic_payments.rb +5 -5
- data/db/migrate/20100214212536_assign_creditcard_txns_to_payment.rb +4 -4
- data/db/migrate/20100528185820_add_index_on_users_persistence_token.rb +3 -1
- data/db/migrate/20100811163637_add_guest_flag.rb +3 -1
- data/db/migrate/20100901171814_change_guest_flag_to_anonymous.rb +3 -1
- data/db/migrate/20101026184959_generate_anonymous_users.rb +3 -3
- data/db/migrate/20101103212716_drop_anonymous_field_for_user.rb +3 -1
- data/db/migrate/20111007143030_namespace_top_level_models.rb +18 -1
- data/db/migrate/20120315064358_migrate_images_from_products_to_variants.rb +6 -4
- data/db/migrate/20120509055454_create_tokenized_permissions_table.rb +16 -0
- data/db/migrate/20120530012000_rename_creditcards_to_credit_cards.rb +11 -0
- data/db/migrate/20120604203654_remove_credit_total_from_orders.rb +5 -0
- data/lib/generators/spree/custom_user/custom_user_generator.rb +53 -0
- data/lib/generators/spree/custom_user/templates/authentication_helpers.rb.tt +28 -0
- data/lib/generators/spree/custom_user/templates/initializer.rb.tt +1 -0
- data/lib/generators/spree/custom_user/templates/migration.rb.tt +7 -0
- data/lib/generators/spree/dummy/dummy_generator.rb +3 -0
- data/lib/generators/spree/dummy/templates/initializers/custom_user.rb +1 -0
- data/lib/generators/spree/install/templates/app/assets/javascripts/admin/all.js +0 -1
- data/lib/generators/spree/install/templates/app/assets/javascripts/store/all.js +0 -1
- data/lib/generators/spree/install/templates/app/assets/stylesheets/admin/all.css +0 -1
- data/lib/generators/spree/install/templates/app/assets/stylesheets/store/all.css +0 -1
- data/lib/generators/spree/install/templates/config/initializers/spree.rb +2 -0
- data/lib/spree/core.rb +15 -2
- data/lib/spree/core/controller_helpers.rb +123 -62
- data/lib/spree/core/current_order.rb +5 -0
- data/lib/spree/core/engine.rb +1 -1
- data/lib/spree/core/mail_settings.rb +1 -2
- data/lib/spree/core/permalinks.rb +1 -5
- data/lib/spree/core/preference_rescue.rb +8 -4
- data/lib/spree/core/relation_serialization.rb +9 -0
- data/lib/spree/core/respond_with.rb +1 -1
- data/lib/spree/core/s3_support.rb +25 -0
- data/lib/spree/core/search/base.rb +2 -5
- data/lib/spree/core/ssl_requirement.rb +2 -2
- data/lib/spree/core/store_helpers.rb +1 -2
- data/lib/spree/core/testing_support/controller_requests.rb +1 -0
- data/lib/spree/core/testing_support/env.rb +2 -0
- data/lib/spree/core/testing_support/factories/{creditcard_factory.rb → credit_card_factory.rb} +3 -3
- data/lib/spree/core/testing_support/factories/payment_factory.rb +1 -1
- data/lib/spree/core/testing_support/factories/product_factory.rb +4 -4
- data/lib/spree/core/testing_support/factories/user_factory.rb +3 -3
- data/lib/spree/core/testing_support/factories/zone_factory.rb +2 -3
- data/lib/spree/core/token_resource.rb +27 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/product_filters.rb +12 -13
- data/lib/tasks/core.rake +1 -1
- metadata +146 -154
- data/app/assets/images/noimage/large.png +0 -0
- data/app/assets/javascripts/admin/images/index.js +0 -10
- data/app/assets/javascripts/admin/images/new.js +0 -5
- data/app/assets/javascripts/admin/products.js +0 -2
- data/app/assets/javascripts/store/cart.js +0 -11
- data/app/assets/javascripts/store/checkout.js +0 -78
- data/app/assets/javascripts/store/product.js +0 -49
- data/app/controllers/spree/admin/users_controller.rb +0 -68
- data/app/views/spree/admin/option_types/_available.html.erb +0 -28
- data/app/views/spree/admin/option_types/_selected.html.erb +0 -26
- data/app/views/spree/admin/option_types/available.js.erb +0 -2
- data/app/views/spree/admin/option_types/select.js.erb +0 -3
- data/app/views/spree/admin/option_types/selected.html.erb +0 -6
- data/app/views/spree/admin/orders/history.html.erb +0 -29
- data/app/views/spree/admin/products/_option_types.html.erb +0 -40
- data/app/views/spree/admin/shared/_additional_field.html.erb +0 -5
- data/app/views/spree/admin/shared/_routes.html.erb +0 -8
- data/app/views/spree/admin/shared/_translations.html.erb +0 -17
- data/app/views/spree/admin/taxons/available.js.erb +0 -26
- data/app/views/spree/admin/taxons/remove.html.erb +0 -1
- data/app/views/spree/admin/taxons/select.js.erb +0 -2
- data/app/views/spree/admin/taxons/selected.html.erb +0 -42
- data/app/views/spree/admin/users/_form.html.erb +0 -19
- data/app/views/spree/admin/users/edit.html.erb +0 -14
- data/app/views/spree/admin/users/index.html.erb +0 -48
- data/app/views/spree/admin/users/new.html.erb +0 -14
- data/app/views/spree/admin/users/show.html.erb +0 -21
- data/app/views/spree/shared/_store_menu.html.erb +0 -2
- data/config/initializers/rails_5868.rb +0 -8
- data/db/migrate/20120605211305_make_users_email_index_unique.rb +0 -10
- data/db/migrate/20121017010007_remove_not_null_constraint_from_products_on_hand.rb +0 -11
- data/db/sample/users.rb +0 -61
- data/lib/generators/spree/sandbox/sandbox_generator.rb +0 -36
- data/lib/generators/spree/sandbox/templates/rails/routes.rb +0 -7
- data/lib/spree/core/ext/array.rb +0 -14
- data/lib/spree/core/ext/hash.rb +0 -75
- data/lib/spree/core/ext/string.rb +0 -10
- data/lib/tasks/install.rake +0 -18
data/config/routes.rb
CHANGED
@@ -11,23 +11,14 @@ Spree::Core::Engine.routes.draw do
|
|
11
11
|
resources :states, :only => :index
|
12
12
|
|
13
13
|
# non-restful checkout stuff
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
populate_redirect = redirect do |params, request|
|
19
|
-
request.flash[:error] = I18n.t(:populate_get_error)
|
20
|
-
request.referer || '/cart'
|
21
|
-
end
|
22
|
-
|
23
|
-
get '/orders/populate', :via => :get, :to => populate_redirect
|
14
|
+
put '/checkout/update/:state', :to => 'checkout#update', :as => :update_checkout
|
15
|
+
get '/checkout/:state', :to => 'checkout#edit', :as => :checkout_state
|
16
|
+
get '/checkout', :to => 'checkout#edit', :state => 'address', :as => :checkout
|
24
17
|
|
25
18
|
resources :orders do
|
26
19
|
post :populate, :on => :collection
|
27
20
|
|
28
21
|
resources :line_items
|
29
|
-
resources :creditcards
|
30
|
-
resources :creditcard_payments
|
31
22
|
|
32
23
|
resources :shipments do
|
33
24
|
member do
|
@@ -51,11 +42,13 @@ Spree::Core::Engine.routes.draw do
|
|
51
42
|
match '/t/*id', :to => 'taxons#show', :as => :nested_taxons
|
52
43
|
|
53
44
|
namespace :admin do
|
45
|
+
get '/search/users', :to => "search#users", :as => :search_users
|
46
|
+
|
54
47
|
resources :adjustments
|
55
48
|
resources :zones
|
56
|
-
resources :
|
49
|
+
resources :banners do
|
57
50
|
member do
|
58
|
-
post :
|
51
|
+
post :dismiss
|
59
52
|
end
|
60
53
|
end
|
61
54
|
resources :countries do
|
@@ -79,28 +72,6 @@ Spree::Core::Engine.routes.draw do
|
|
79
72
|
post :update_positions
|
80
73
|
end
|
81
74
|
end
|
82
|
-
resources :option_types do
|
83
|
-
member do
|
84
|
-
get :select
|
85
|
-
get :remove
|
86
|
-
end
|
87
|
-
collection do
|
88
|
-
get :available
|
89
|
-
get :selected
|
90
|
-
post :update_positions
|
91
|
-
end
|
92
|
-
end
|
93
|
-
resources :taxons do
|
94
|
-
member do
|
95
|
-
get :select
|
96
|
-
delete :remove
|
97
|
-
end
|
98
|
-
collection do
|
99
|
-
post :available
|
100
|
-
post :batch_select
|
101
|
-
get :selected
|
102
|
-
end
|
103
|
-
end
|
104
75
|
end
|
105
76
|
|
106
77
|
resources :option_types do
|
@@ -135,7 +106,6 @@ Spree::Core::Engine.routes.draw do
|
|
135
106
|
put :fire
|
136
107
|
get :fire
|
137
108
|
post :resend
|
138
|
-
get :history
|
139
109
|
end
|
140
110
|
|
141
111
|
resource :customer, :controller => "orders/customer_details"
|
@@ -344,18 +344,20 @@ class SpreeZeroNineZero < ActiveRecord::Migration
|
|
344
344
|
t.timestamps
|
345
345
|
end
|
346
346
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
347
|
+
unless defined?(User)
|
348
|
+
create_table :users, :force => true do |t|
|
349
|
+
t.string :crypted_password, :limit => 128, :default => '', :null => false
|
350
|
+
t.string :salt, :limit => 128, :default => '', :null => false
|
351
|
+
t.string :email, :remember_token, :remember_token_expires_at,
|
352
|
+
:persistence_token, :single_access_token, :perishable_token
|
353
|
+
t.integer :login_count, :default => 0, :null => false
|
354
|
+
t.integer :failed_login_count, :default => 0, :null => false
|
355
|
+
t.datetime :last_request_at, :current_login_at, :last_login_at
|
356
|
+
t.string :current_login_ip, :last_login_ip, :login
|
357
|
+
t.integer :ship_address_id, :bill_address_id
|
358
|
+
|
359
|
+
t.timestamps
|
360
|
+
end
|
359
361
|
end
|
360
362
|
|
361
363
|
create_table :variants, :force => true do |t|
|
@@ -1,24 +1,26 @@
|
|
1
1
|
class AddOpenidFieldToUsers < ActiveRecord::Migration
|
2
2
|
def up
|
3
|
-
|
4
|
-
|
3
|
+
unless defined?(User)
|
4
|
+
add_column :users, :openid_identifier, :string
|
5
|
+
add_index :users, :openid_identifier
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
change_column :users, :login, :string, :default => nil, :null => true
|
8
|
+
change_column :users, :crypted_password, :string, :default => nil, :null => true
|
9
|
+
change_column :users, :salt, :string, :default => nil, :null => true
|
10
|
+
end
|
9
11
|
end
|
10
12
|
|
11
13
|
def down
|
12
14
|
remove_column :users, :openid_identifier
|
13
15
|
|
14
16
|
# Due to namespacing change, temporarily set the table back to users
|
15
|
-
Spree::
|
17
|
+
Spree::LegacyUser.table_name = 'users'
|
16
18
|
|
17
19
|
[:login, :crypted_password, :salt].each do |field|
|
18
20
|
Spree::User.where(field => nil).each { |user| user.update_column(field, '') if user.send(field).nil? }
|
19
21
|
change_column :users, field, :string, :default => '', :null => false
|
20
22
|
end
|
21
23
|
|
22
|
-
Spree::
|
24
|
+
Spree::LegacyUser.table_name = 'spree_users'
|
23
25
|
end
|
24
26
|
end
|
@@ -12,17 +12,17 @@ class PolymorphicPayments < ActiveRecord::Migration
|
|
12
12
|
end
|
13
13
|
execute "UPDATE payments SET payable_type = 'Order'"
|
14
14
|
|
15
|
-
Spree::
|
15
|
+
Spree::CreditCard.table_name = 'creditcards'
|
16
16
|
|
17
|
-
Spree::
|
18
|
-
if checkout = Checkout.find_by_id(
|
17
|
+
Spree::CreditCard.all.each do |credit_card|
|
18
|
+
if checkout = Checkout.find_by_id(credit_card.checkout_id) && checkout.order
|
19
19
|
if payment = checkout.order.payments.first
|
20
|
-
execute "UPDATE payments SET source_type = '
|
20
|
+
execute "UPDATE payments SET source_type = 'CreditCard', source_id = #{credit_card.id} WHERE id = #{payment.id}"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
Spree::
|
25
|
+
Spree::CreditCard.table_name = 'spree_creditcards'
|
26
26
|
|
27
27
|
remove_column :creditcards, :checkout_id
|
28
28
|
end
|
@@ -3,15 +3,15 @@ class AssignCreditcardTxnsToPayment < ActiveRecord::Migration
|
|
3
3
|
add_column :creditcard_txns, :payment_id, :integer
|
4
4
|
|
5
5
|
# Temporarily set back to creditcards
|
6
|
-
Spree::
|
6
|
+
Spree::CreditCard.table_name = 'creditcards'
|
7
7
|
|
8
8
|
ActiveRecord::Base.connection.select_all('SELECT * FROM creditcard_txns').each do |txn_attrs|
|
9
|
-
if
|
10
|
-
execute "UPDATE creditcard_txns SET payment_id = #{
|
9
|
+
if credit_card = Spree::CreditCard.find_by_id(txn_attrs['creditcard_id']) && credit_card.payments.first
|
10
|
+
execute "UPDATE creditcard_txns SET payment_id = #{credit_card.payments.first.id} WHERE id = #{txn_attrs['id']}"
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
Spree::
|
14
|
+
Spree::CreditCard.table_name = 'spree_creditcards'
|
15
15
|
|
16
16
|
remove_column :creditcard_txns, :creditcard_payment_id
|
17
17
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
class GenerateAnonymousUsers < ActiveRecord::Migration
|
2
2
|
def up
|
3
|
-
Spree::
|
3
|
+
Spree::LegacyUser.table_name = 'users'
|
4
4
|
Spree::Order.table_name = 'orders'
|
5
5
|
|
6
|
-
Spree::
|
6
|
+
Spree::LegacyUser.reset_column_information
|
7
7
|
Spree::Order.where(:user_id => nil).each do |order|
|
8
8
|
user = Spree::User.anonymous!
|
9
9
|
user.email ||= order.email
|
@@ -11,7 +11,7 @@ class GenerateAnonymousUsers < ActiveRecord::Migration
|
|
11
11
|
order.save!
|
12
12
|
end
|
13
13
|
|
14
|
-
Spree::
|
14
|
+
Spree::LegacyUser.table_name = 'spree_users'
|
15
15
|
Spree::Order.table_name = 'spree_orders'
|
16
16
|
end
|
17
17
|
|
@@ -41,9 +41,26 @@ class NamespaceTopLevelModels < ActiveRecord::Migration
|
|
41
41
|
rename_table :taxons, :spree_taxons
|
42
42
|
rename_table :taxonomies, :spree_taxonomies
|
43
43
|
rename_table :trackers, :spree_trackers
|
44
|
-
|
44
|
+
unless defined?(User) || table_exists?(:spree_users)
|
45
|
+
rename_table :users, :spree_users
|
46
|
+
end
|
45
47
|
rename_table :variants, :spree_variants
|
46
48
|
rename_table :zones, :spree_zones
|
47
49
|
rename_table :zone_members, :spree_zone_members
|
50
|
+
|
51
|
+
rename_index :spree_configurations, 'index_configurations_on_name_and_type', 'index_spree_configurations_on_name_and_type'
|
52
|
+
rename_index :spree_line_items, 'index_line_items_on_order_id', 'index_spree_line_items_on_order_id'
|
53
|
+
rename_index :spree_line_items, 'index_line_items_on_variant_id', 'index_spree_line_items_on_variant_id'
|
54
|
+
rename_index :spree_option_values_variants, 'index_option_values_variants_on_variant_id', 'index_spree_option_values_variants_on_variant_id'
|
55
|
+
rename_index :spree_orders, 'index_orders_on_number', 'index_spree_orders_on_number'
|
56
|
+
rename_index :spree_products, 'index_products_on_available_on', 'index_spree_products_on_available_on'
|
57
|
+
rename_index :spree_products, 'index_products_on_deleted_at', 'index_spree_products_on_deleted_at'
|
58
|
+
rename_index :spree_products, 'index_products_on_name', 'index_spree_products_on_name'
|
59
|
+
rename_index :spree_products, 'index_products_on_permalink', 'index_spree_products_on_permalink'
|
60
|
+
rename_index :spree_products_taxons, 'index_products_taxons_on_product_id', 'index_spree_products_taxons_on_product_id'
|
61
|
+
rename_index :spree_products_taxons, 'index_products_taxons_on_taxon_id', 'index_spree_products_taxons_on_taxon_id'
|
62
|
+
rename_index :spree_roles_users, 'index_roles_users_on_role_id', 'index_spree_roles_users_on_role_id'
|
63
|
+
rename_index :spree_roles_users, 'index_roles_users_on_user_id', 'index_spree_roles_users_on_user_id'
|
64
|
+
rename_index :spree_variants, 'index_variants_on_product_id', 'index_spree_variants_on_product_id'
|
48
65
|
end
|
49
66
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
class MigrateImagesFromProductsToVariants < ActiveRecord::Migration
|
2
2
|
def up
|
3
3
|
images = select_all("SELECT spree_assets.* FROM spree_assets
|
4
|
-
WHERE spree_assets.type
|
5
|
-
AND spree_assets.viewable_type = 'Spree::Product'
|
4
|
+
WHERE spree_assets.type = 'Spree::Image'
|
5
|
+
AND spree_assets.viewable_type = 'Spree::Product'
|
6
|
+
AND spree_assets.viewable_id IS NOT NULL")
|
6
7
|
|
7
8
|
images.each do |image|
|
8
9
|
master_variant_id = select_value("SELECT id FROM spree_variants
|
@@ -19,8 +20,9 @@ class MigrateImagesFromProductsToVariants < ActiveRecord::Migration
|
|
19
20
|
JOIN spree_variants
|
20
21
|
ON spree_variants.id = spree_assets.viewable_id
|
21
22
|
AND spree_variants.is_master = #{quoted_true}
|
22
|
-
WHERE spree_assets.type
|
23
|
-
AND spree_assets.viewable_type = 'Spree::Variant'
|
23
|
+
WHERE spree_assets.type = 'Spree::Image'
|
24
|
+
AND spree_assets.viewable_type = 'Spree::Variant'
|
25
|
+
AND spree_assets.viewable_id IS NOT NULL")
|
24
26
|
|
25
27
|
images.each do |image|
|
26
28
|
product_id = select_value("SELECT spree_products.id FROM spree_products
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateTokenizedPermissionsTable < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
unless Spree::TokenizedPermission.table_exists?
|
4
|
+
create_table :spree_tokenized_permissions do |t|
|
5
|
+
t.integer :permissable_id
|
6
|
+
t.string :permissable_type
|
7
|
+
t.string :token
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
|
12
|
+
add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], :name => 'index_tokenized_name_and_type'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class RenameCreditcardsToCreditCards < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
rename_table :spree_creditcards, :spree_credit_cards
|
4
|
+
execute("UPDATE spree_payments SET source_type = 'Spree::CreditCard' WHERE source_type = 'Spree::Creditcard'")
|
5
|
+
end
|
6
|
+
|
7
|
+
def down
|
8
|
+
execute("UPDATE spree_payments SET source_type = 'Spree::Creditcard' WHERE source_type = 'Spree::CreditCard'")
|
9
|
+
rename_table :spree_credit_cards, :spree_creditcards
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Spree
|
2
|
+
class CustomUserGenerator < Rails::Generators::NamedBase
|
3
|
+
include Rails::Generators::ResourceHelpers
|
4
|
+
include Rails::Generators::Migration
|
5
|
+
|
6
|
+
|
7
|
+
desc "Set up a Spree installation with a custom User class"
|
8
|
+
|
9
|
+
def self.source_paths
|
10
|
+
paths = self.superclass.source_paths
|
11
|
+
paths << File.expand_path('../templates', __FILE__)
|
12
|
+
paths.flatten
|
13
|
+
end
|
14
|
+
|
15
|
+
def check_for_constant
|
16
|
+
begin
|
17
|
+
klass
|
18
|
+
rescue NameError
|
19
|
+
@shell.say "Couldn't find #{class_name}. Are you sure that this class exists within your application and is loaded?", :red
|
20
|
+
exit(1)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def generate
|
25
|
+
migration_template 'migration.rb.tt', "db/migrate/add_spree_fields_to_custom_user_table.rb"
|
26
|
+
template 'authentication_helpers.rb.tt', "lib/spree/authentication_helpers.rb"
|
27
|
+
|
28
|
+
file_action = File.exist?('config/initializers/spree.rb') ? :append_file : :create_file
|
29
|
+
send(file_action, 'config/initializers/spree.rb') do
|
30
|
+
%Q{require 'spree/authentication_helpers'\n}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.next_migration_number(dirname)
|
35
|
+
if ActiveRecord::Base.timestamped_migrations
|
36
|
+
sleep 1 # make sure to get a different migration every time
|
37
|
+
Time.new.utc.strftime("%Y%m%d%H%M%S")
|
38
|
+
else
|
39
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def klass
|
44
|
+
class_name.constantize
|
45
|
+
end
|
46
|
+
|
47
|
+
def table_name
|
48
|
+
klass.table_name
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Spree
|
2
|
+
module AuthenticationHelpers
|
3
|
+
def self.included(receiver)
|
4
|
+
receiver.send :helper_method, :spree_login_path
|
5
|
+
receiver.send :helper_method, :spree_signup_path
|
6
|
+
receiver.send :helper_method, :spree_logout_path
|
7
|
+
receiver.send :helper_method, :spree_current_user
|
8
|
+
end
|
9
|
+
|
10
|
+
def spree_current_user
|
11
|
+
current_user
|
12
|
+
end
|
13
|
+
|
14
|
+
def spree_login_path
|
15
|
+
main_app.login_path
|
16
|
+
end
|
17
|
+
|
18
|
+
def spree_signup_path
|
19
|
+
main_app.signup_path
|
20
|
+
end
|
21
|
+
|
22
|
+
def spree_logout_path
|
23
|
+
main_app.logout_path
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
ApplicationController.send :include, Spree::AuthenticationHelpers
|
@@ -0,0 +1 @@
|
|
1
|
+
Spree.user_class = "<%= class_name %>"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class AddSpreeFieldsToCustomUserTable < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column <%= table_name.inspect %>, :spree_api_key, :string, :limit => 48
|
4
|
+
add_column <%= table_name.inspect %>, :ship_address_id, :integer
|
5
|
+
add_column <%= table_name.inspect %>, :bill_address_id, :integer
|
6
|
+
end
|
7
|
+
end
|
@@ -42,6 +42,7 @@ module Spree
|
|
42
42
|
template "rails/application.rb", "#{dummy_path}/config/application.rb", :force => true
|
43
43
|
template "rails/routes.rb", "#{dummy_path}/config/routes.rb", :force => true
|
44
44
|
template "rails/script/rails", "#{dummy_path}/spec/dummy/script/rails", :force => true
|
45
|
+
template "initializers/custom_user.rb", "#{dummy_path}/config/initializers/custom_user.rb", :force => true
|
45
46
|
end
|
46
47
|
|
47
48
|
def test_dummy_clean
|
@@ -51,11 +52,13 @@ module Spree
|
|
51
52
|
remove_file "Gemfile"
|
52
53
|
remove_file "lib/tasks"
|
53
54
|
remove_file "app/assets/images/rails.png"
|
55
|
+
remove_file "app/assets/javascripts/application.js"
|
54
56
|
remove_file "public/index.html"
|
55
57
|
remove_file "public/robots.txt"
|
56
58
|
remove_file "README"
|
57
59
|
remove_file "test"
|
58
60
|
remove_file "vendor"
|
61
|
+
remove_file "spec"
|
59
62
|
end
|
60
63
|
end
|
61
64
|
|