spree 0.10.2 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spree might be problematic. Click here for more details.
- data/CHANGELOG +81 -4
- data/CONTRIBUTORS +18 -10
- data/Rakefile +5 -4
- data/app/controllers/admin/adjustments_controller.rb +17 -3
- data/app/controllers/admin/base_controller.rb +2 -2
- data/app/controllers/admin/checkouts_controller.rb +43 -34
- data/app/controllers/admin/line_items_controller.rb +32 -18
- data/app/controllers/admin/option_types_controller.rb +1 -1
- data/app/controllers/admin/orders_controller.rb +28 -7
- data/app/controllers/admin/payments_controller.rb +7 -7
- data/app/controllers/admin/products_controller.rb +12 -23
- data/app/controllers/admin/reports_controller.rb +19 -7
- data/app/controllers/admin/return_authorizations_controller.rb +1 -1
- data/app/controllers/admin/shipments_controller.rb +9 -9
- data/app/controllers/admin/users_controller.rb +3 -1
- data/app/controllers/admin/variants_controller.rb +2 -2
- data/app/controllers/checkouts_controller.rb +29 -18
- data/app/controllers/content_controller.rb +1 -1
- data/{vendor/extensions/localization/app → app}/controllers/locale_controller.rb +1 -1
- data/app/controllers/orders_controller.rb +33 -30
- data/app/controllers/password_resets_controller.rb +4 -4
- data/app/controllers/products_controller.rb +0 -6
- data/app/controllers/spree/base_controller.rb +9 -2
- data/app/controllers/user_sessions_controller.rb +18 -18
- data/app/controllers/users_controller.rb +2 -2
- data/app/helpers/admin/base_helper.rb +5 -2
- data/app/helpers/admin/navigation_helper.rb +1 -1
- data/app/helpers/admin/orders_helper.rb +0 -13
- data/app/helpers/admin/products_helper.rb +0 -8
- data/app/helpers/checkouts_helper.rb +5 -5
- data/app/helpers/products_helper.rb +0 -12
- data/app/helpers/spree/base_helper.rb +10 -39
- data/app/helpers/taxons_helper.rb +1 -0
- data/app/models/address.rb +6 -1
- data/app/models/app_configuration.rb +15 -14
- data/app/models/calculator/flexi_rate.rb +2 -1
- data/app/models/calculator/vat.rb +1 -1
- data/app/models/checkout.rb +1 -1
- data/app/models/creditcard.rb +26 -20
- data/app/models/inventory_unit.rb +70 -21
- data/app/models/line_item.rb +25 -11
- data/app/models/order.rb +16 -10
- data/app/models/payment.rb +4 -1
- data/app/models/payment_method.rb +14 -5
- data/app/models/product.rb +12 -4
- data/app/models/role.rb +2 -2
- data/app/models/shipment.rb +21 -2
- data/app/models/tax_category.rb +8 -0
- data/app/models/taxon.rb +8 -0
- data/app/models/user.rb +2 -3
- data/app/models/variant.rb +18 -13
- data/config/boot.rb +1 -5
- data/config/cucumber.yml +7 -0
- data/config/database.yml +20 -37
- data/config/database.yml.example +5 -6
- data/config/environment.rb +6 -5
- data/config/environments/cucumber.rb +30 -0
- data/config/environments/production.rb +1 -4
- data/config/environments/staging.rb +3 -0
- data/config/environments/test.rb +1 -1
- data/config/initializers/cookie_verification_secret.rb +7 -0
- data/config/initializers/locales.rb +4 -2
- data/config/initializers/new_rails_defaults.rb +2 -0
- data/config/initializers/spree.rb +1 -0
- data/config/initializers/workarounds_for_ruby19.rb +0 -25
- data/config/locales/{en-US.yml → en_spree.yml} +18 -4
- data/config/routes.rb +2 -1
- data/db/migrate/20100317120946_add_alt_text_to_images.rb +9 -0
- data/db/migrate/20100427121301_add_display_to_payment_methods.rb +9 -0
- data/db/migrate/20100504142133_add_addresses_checkouts_indexes.rb +16 -0
- data/db/migrate/20100506180619_add_icon_to_taxons.rb +18 -0
- data/db/migrate/20100506185838_add_description_to_taxons.rb +11 -0
- data/db/migrate/20100528155333_index_for_shipments_number.rb +9 -0
- data/db/migrate/20100528185820_add_index_on_users_persistence_token.rb +9 -0
- data/db/migrate/20100605152042_add_default_to_tax_categories.rb +9 -0
- data/db/sample/payment_methods.yml +8 -1
- data/db/sample/shipments.yml +2 -2
- data/db/schema.rb +54 -21
- data/features/checkout.feature +98 -0
- data/features/create_admin_user.feature +18 -0
- data/features/search.feature +35 -0
- data/features/sign_in.feature +25 -0
- data/features/sign_out.feature +12 -0
- data/features/sign_up.feature +20 -0
- data/features/step_definitions/error_steps.rb +3 -0
- data/features/step_definitions/model_steps.rb +3 -0
- data/features/step_definitions/pickle_steps.rb +73 -0
- data/features/step_definitions/role_steps.rb +8 -0
- data/features/step_definitions/session_steps.rb +14 -0
- data/features/step_definitions/user_steps.rb +67 -0
- data/features/step_definitions/web_steps.rb +197 -0
- data/features/support/create_admin_user.rb +6 -0
- data/features/support/env.rb +89 -0
- data/features/support/paths.rb +32 -0
- data/features/support/pickle.rb +24 -0
- data/features/work_with_cart.feature +41 -0
- data/lib/generators/extension_model/extension_model_generator.rb +10 -10
- data/lib/generators/instance/templates/databases/mysql.yml +11 -0
- data/lib/scopes/variant.rb +10 -0
- data/lib/spree.rb +3 -3
- data/lib/spree/extensions.rb +1 -1
- data/lib/tasks/cucumber.rake +47 -0
- data/lib/tasks/database.rake +29 -29
- data/public/images/admin/bg/spree_50.png +0 -0
- data/public/images/tile-header.png +0 -0
- data/public/images/tile-slider.png +0 -0
- data/public/javascripts/admin/checkouts/edit.js +33 -0
- data/public/javascripts/dashboard.js +2 -2
- data/public/javascripts/taxonomy.js +2 -2
- data/public/stylesheets/admin/admin-tables.css +4 -0
- data/public/stylesheets/admin/admin.css +31 -16
- data/public/stylesheets/screen.css +16 -3
- data/script/about +3 -2
- data/script/console +2 -2
- data/script/cucumber +10 -0
- data/script/dbconsole +1 -1
- data/script/destroy +2 -2
- data/script/generate +2 -2
- data/script/performance/benchmarker +1 -1
- data/script/performance/profiler +1 -1
- data/script/plugin +2 -2
- data/script/runner +2 -2
- data/script/server +2 -2
- data/test/fixtures/payment_methods.yml +12 -0
- data/test/functional/admin/checkouts_controller_test.rb +0 -2
- data/test/functional/admin/line_items_controller_test.rb +78 -39
- data/test/functional/admin/products_controller_test.rb +4 -5
- data/test/integration/checkout_test.rb +1 -0
- data/test/test_helper.rb +114 -86
- data/test/unit/creditcard_test.rb +28 -7
- data/test/unit/flexi_rate_calculator_test.rb +75 -0
- data/test/unit/helpers/products_helper_test.rb +4 -4
- data/test/unit/inventory_unit_test.rb +39 -5
- data/test/unit/line_item_test.rb +60 -1
- data/test/unit/order_state_test.rb +85 -58
- data/test/unit/order_test.rb +144 -123
- data/test/unit/product_test.rb +21 -0
- data/test/unit/return_authorization_test.rb +22 -28
- data/test/unit/shipment_test.rb +19 -7
- data/test/unit/variant_test.rb +100 -24
- data/vendor/extensions/api/api_extension.rb +2 -2
- data/vendor/extensions/api/app/controllers/api/base_controller.rb +14 -6
- data/vendor/extensions/api/app/controllers/api/countries_controller.rb +4 -0
- data/vendor/extensions/api/app/controllers/api/orders_controller.rb +4 -4
- data/vendor/extensions/api/app/controllers/api/products_controller.rb +5 -1
- data/vendor/extensions/api/app/controllers/api/shipments_controller.rb +7 -7
- data/vendor/extensions/api/app/controllers/api/states_controller.rb +5 -0
- data/vendor/extensions/api/config/locales/{en-US.yml → en.yml} +2 -2
- data/vendor/extensions/api/config/routes.rb +5 -0
- data/vendor/extensions/api/test/integration/orders_api_test.rb +4 -4
- data/vendor/extensions/overview_dashboard/app/views/admin/overview/index.html.erb +1 -1
- data/vendor/extensions/payment_gateway/app/models/gateway.rb +1 -1
- data/vendor/extensions/payment_gateway/app/models/gateway/authorize_net_cim.rb +41 -29
- data/vendor/extensions/payment_gateway/app/models/gateway/bogus.rb +3 -3
- data/vendor/extensions/payment_gateway/app/models/gateway/eway.rb +11 -0
- data/vendor/extensions/payment_gateway/app/models/gateway/sage_pay.rb +9 -0
- data/vendor/extensions/payment_gateway/config/locales/{en-US.yml → en.yml} +1 -1
- data/vendor/extensions/payment_gateway/lib/spree/payment_gateway.rb +46 -56
- data/vendor/extensions/payment_gateway/payment_gateway_extension.rb +9 -10
- data/vendor/extensions/payment_gateway/test/unit/authorize_net_cim_test.rb +7 -6
- data/vendor/extensions/theme_default/app/stylesheets/_checkout.less +10 -3
- data/vendor/extensions/theme_default/app/views/admin/adjustments/index.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/checkouts/_form.html.erb +31 -5
- data/vendor/extensions/theme_default/app/views/admin/checkouts/show.html.erb +27 -16
- data/vendor/extensions/theme_default/app/views/admin/images/_form.html.erb +4 -0
- data/vendor/extensions/theme_default/app/views/admin/images/index.html.erb +16 -13
- data/vendor/extensions/theme_default/app/views/admin/orders/_add_product.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/orders/_form.html.erb +7 -0
- data/vendor/extensions/theme_default/app/views/admin/orders/index.html.erb +5 -5
- data/vendor/extensions/theme_default/app/views/admin/payment_methods/_form.html.erb +12 -6
- data/vendor/extensions/theme_default/app/views/admin/payment_methods/index.html.erb +22 -11
- data/vendor/extensions/theme_default/app/views/admin/product_groups/update.js.erb +2 -2
- data/vendor/extensions/theme_default/app/views/admin/products/_form.html.erb +6 -4
- data/vendor/extensions/theme_default/app/views/admin/shared/_address_form.html.erb +64 -55
- data/vendor/extensions/theme_default/app/views/admin/shared/_configuration_menu.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/shared/_order_tabs.html.erb +11 -3
- data/vendor/extensions/theme_default/app/views/admin/shared/_product_tabs.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/shipments/_form.html.erb +32 -29
- data/vendor/extensions/theme_default/app/views/admin/shipments/index.html.erb +2 -1
- data/vendor/extensions/theme_default/app/views/admin/tax_categories/_form.html.erb +6 -3
- data/vendor/extensions/theme_default/app/views/admin/tax_categories/index.html.erb +4 -2
- data/vendor/extensions/theme_default/app/views/admin/taxonomies/_taxon.html.erb +2 -2
- data/vendor/extensions/theme_default/app/views/admin/taxons/_form.html.erb +11 -1
- data/vendor/extensions/theme_default/app/views/admin/taxons/edit.html.erb +2 -2
- data/vendor/extensions/theme_default/app/views/admin/users/_form.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/variants/_form.html.erb +4 -2
- data/vendor/extensions/theme_default/app/views/checkouts/_confirm.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/checkouts/_delivery.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/checkouts/_summary.html.erb +6 -6
- data/vendor/extensions/theme_default/app/views/checkouts/edit.html.erb +3 -3
- data/vendor/extensions/theme_default/app/views/layouts/admin.html.erb +7 -5
- data/vendor/extensions/theme_default/app/views/layouts/spree_application.html.erb +8 -4
- data/vendor/extensions/theme_default/app/views/orders/_line_item.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/products/index.html.erb +0 -1
- data/vendor/extensions/theme_default/app/views/shared/_footer.html.erb +4 -2
- data/vendor/extensions/theme_default/app/views/shared/_products.html.erb +3 -1
- data/vendor/extensions/theme_default/app/views/shared/_user_form.html.erb +1 -1
- data/vendor/extensions/theme_default/public/images/admin/bg/spree_50.png +0 -0
- data/vendor/extensions/theme_default/public/images/tile-header.png +0 -0
- data/vendor/extensions/theme_default/public/images/tile-slider.png +0 -0
- data/vendor/extensions/theme_default/public/javascripts/admin/checkouts/edit.js +50 -0
- data/vendor/extensions/theme_default/public/javascripts/taxonomy.js +2 -2
- data/vendor/extensions/theme_default/public/stylesheets/admin/admin-tables.css +8 -0
- data/vendor/extensions/theme_default/public/stylesheets/admin/admin.css +31 -16
- data/vendor/extensions/theme_default/public/stylesheets/screen.css +16 -3
- data/vendor/plugins/attribute_fu/{tasks → lib/tasks}/attribute_fu_tasks.rake +0 -0
- data/vendor/plugins/enumerable_constants/{tasks → lib/tasks}/enumerable_constants_tasks.rake +0 -0
- data/vendor/plugins/find_by_param/lib/find_by_param.rb +9 -5
- data/vendor/plugins/find_by_param/{tasks → lib/tasks}/find_by_param_tasks.rake +0 -0
- data/vendor/plugins/jrails/{tasks → lib/tasks}/jrails.rake +0 -0
- data/vendor/plugins/jrails_auto_complete/{tasks → lib/tasks}/jrails_auto_complete_tasks.rake +0 -0
- data/vendor/plugins/mail_queue/{tasks → lib/tasks}/mailer_queue_tasks.rake +0 -0
- data/vendor/plugins/open_id_authentication/{tasks → lib/tasks}/open_id_authentication_tasks.rake +0 -0
- data/vendor/plugins/resource_controller/lib/resource_controller/helpers/internal.rb +2 -2
- data/vendor/plugins/ssl_requirement/lib/ssl_requirement.rb +7 -7
- data/vendor/plugins/unobtrusive_date_picker/{tasks → lib/tasks}/datepicker_tasks.rake +0 -0
- metadata +82 -342
- data/app/helpers/admin/adjustments_helper.rb +0 -2
- data/app/helpers/admin/checkouts_helper.rb +0 -2
- data/app/helpers/admin/line_items_helper.rb +0 -2
- data/app/helpers/admin/properties_helper.rb +0 -9
- data/app/helpers/admin/prototypes_helper.rb +0 -18
- data/app/helpers/admin/return_authorizations_helper.rb +0 -2
- data/config/locales/cs-CZ.yml +0 -924
- data/config/locales/cs-CZ_rails.yml +0 -202
- data/config/locales/da.yml +0 -924
- data/config/locales/da_rails.yml +0 -197
- data/config/locales/de-CH.yml +0 -924
- data/config/locales/de-CH_rails.yml +0 -142
- data/config/locales/de.yml +0 -924
- data/config/locales/de_rails.yml +0 -140
- data/config/locales/en-AU.yml +0 -924
- data/config/locales/en-AU_rails.yml +0 -202
- data/config/locales/en-GB.yml +0 -924
- data/config/locales/en-GB_rails.yml +0 -196
- data/config/locales/en-US_rails.yml +0 -200
- data/config/locales/es.yml +0 -924
- data/config/locales/es_rails.yml +0 -173
- data/config/locales/fi.yml +0 -924
- data/config/locales/fi_rails.yml +0 -143
- data/config/locales/fr-FR.yml +0 -924
- data/config/locales/fr-FR_rails.yml +0 -123
- data/config/locales/il.yml +0 -924
- data/config/locales/il_rails.yml +0 -103
- data/config/locales/it.yml +0 -924
- data/config/locales/it_rails.yml +0 -146
- data/config/locales/jp.yml +0 -924
- data/config/locales/jp_rails.yml +0 -135
- data/config/locales/mx.yml +0 -924
- data/config/locales/mx_rails.yml +0 -181
- data/config/locales/nb-NO.yml +0 -924
- data/config/locales/nb-NO_rails.yml +0 -105
- data/config/locales/nl-BE.yml +0 -924
- data/config/locales/nl-BE_rails.yml +0 -155
- data/config/locales/nl-NL.yml +0 -924
- data/config/locales/nl-NL_rails.yml +0 -172
- data/config/locales/pl.yml +0 -924
- data/config/locales/pl_rails.yml +0 -118
- data/config/locales/pt-BR.yml +0 -924
- data/config/locales/pt-BR_rails.yml +0 -138
- data/config/locales/pt-PT.yml +0 -924
- data/config/locales/pt-PT_rails.yml +0 -133
- data/config/locales/ru-RU.yml +0 -924
- data/config/locales/ru-RU_rails.yml +0 -206
- data/config/locales/th.yml +0 -924
- data/config/locales/th_rails.yml +0 -195
- data/config/locales/vn.yml +0 -924
- data/config/locales/vn_rails.yml +0 -202
- data/lib/tasks/translation.rake +0 -102
- data/vendor/extensions/localization/README.rdoc +0 -5
- data/vendor/extensions/localization/Rakefile +0 -120
- data/vendor/extensions/localization/app/controllers/admin/localization_controller.rb +0 -2
- data/vendor/extensions/localization/app/helpers/locale_helper.rb +0 -2
- data/vendor/extensions/localization/app/helpers/localization_helper.rb +0 -2
- data/vendor/extensions/localization/app/views/shared/_language_bar.html.erb +0 -8
- data/vendor/extensions/localization/config/routes.rb +0 -4
- data/vendor/extensions/localization/lib/localization/user_preferences.rb +0 -9
- data/vendor/extensions/localization/lib/tasks/localization_extension_tasks.rake +0 -17
- data/vendor/extensions/localization/localization_extension.rb +0 -21
- data/vendor/extensions/localization/public/images/flags/ad.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ae.png +0 -0
- data/vendor/extensions/localization/public/images/flags/af.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ag.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ai.png +0 -0
- data/vendor/extensions/localization/public/images/flags/al.png +0 -0
- data/vendor/extensions/localization/public/images/flags/am.png +0 -0
- data/vendor/extensions/localization/public/images/flags/an.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ao.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ar.png +0 -0
- data/vendor/extensions/localization/public/images/flags/as.png +0 -0
- data/vendor/extensions/localization/public/images/flags/at.png +0 -0
- data/vendor/extensions/localization/public/images/flags/au.png +0 -0
- data/vendor/extensions/localization/public/images/flags/aw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ax.png +0 -0
- data/vendor/extensions/localization/public/images/flags/az.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ba.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bb.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bd.png +0 -0
- data/vendor/extensions/localization/public/images/flags/be.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bh.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bi.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bj.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bo.png +0 -0
- data/vendor/extensions/localization/public/images/flags/br.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bs.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bv.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/by.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ca.png +0 -0
- data/vendor/extensions/localization/public/images/flags/catalonia.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cd.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ch.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ci.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ck.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cl.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/co.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cs.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cv.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cx.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cy.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/da.png +0 -0
- data/vendor/extensions/localization/public/images/flags/de.png +0 -0
- data/vendor/extensions/localization/public/images/flags/de_CH.png +0 -0
- data/vendor/extensions/localization/public/images/flags/dj.png +0 -0
- data/vendor/extensions/localization/public/images/flags/dm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/do.png +0 -0
- data/vendor/extensions/localization/public/images/flags/dz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ec.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ee.png +0 -0
- data/vendor/extensions/localization/public/images/flags/eg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/eh.png +0 -0
- data/vendor/extensions/localization/public/images/flags/england.png +0 -0
- data/vendor/extensions/localization/public/images/flags/er.png +0 -0
- data/vendor/extensions/localization/public/images/flags/es.png +0 -0
- data/vendor/extensions/localization/public/images/flags/et.png +0 -0
- data/vendor/extensions/localization/public/images/flags/europeanunion.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fam.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fi.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fj.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fo.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ga.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gb.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gd.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ge.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gh.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gi.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gl.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gp.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gq.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gs.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gy.png +0 -0
- data/vendor/extensions/localization/public/images/flags/hk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/hm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/hn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/hr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ht.png +0 -0
- data/vendor/extensions/localization/public/images/flags/hu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/id.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ie.png +0 -0
- data/vendor/extensions/localization/public/images/flags/il.png +0 -0
- data/vendor/extensions/localization/public/images/flags/in.png +0 -0
- data/vendor/extensions/localization/public/images/flags/io.png +0 -0
- data/vendor/extensions/localization/public/images/flags/iq.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ir.png +0 -0
- data/vendor/extensions/localization/public/images/flags/is.png +0 -0
- data/vendor/extensions/localization/public/images/flags/it.png +0 -0
- data/vendor/extensions/localization/public/images/flags/jm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/jo.png +0 -0
- data/vendor/extensions/localization/public/images/flags/jp.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ke.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kh.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ki.png +0 -0
- data/vendor/extensions/localization/public/images/flags/km.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kp.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ky.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/la.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lb.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/li.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ls.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lv.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ly.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ma.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/md.png +0 -0
- data/vendor/extensions/localization/public/images/flags/me.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mh.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ml.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mo.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mp.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mq.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ms.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mv.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mx.png +0 -0
- data/vendor/extensions/localization/public/images/flags/my.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/na.png +0 -0
- data/vendor/extensions/localization/public/images/flags/nc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ne.png +0 -0
- data/vendor/extensions/localization/public/images/flags/nf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ng.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ni.png +0 -0
- data/vendor/extensions/localization/public/images/flags/nl.png +0 -0
- data/vendor/extensions/localization/public/images/flags/no.png +0 -0
- data/vendor/extensions/localization/public/images/flags/np.png +0 -0
- data/vendor/extensions/localization/public/images/flags/nr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/nu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/nz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/om.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pa.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pe.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ph.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pl.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ps.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/py.png +0 -0
- data/vendor/extensions/localization/public/images/flags/qa.png +0 -0
- data/vendor/extensions/localization/public/images/flags/re.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ro.png +0 -0
- data/vendor/extensions/localization/public/images/flags/rs.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ru.png +0 -0
- data/vendor/extensions/localization/public/images/flags/rw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sa.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sb.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/scotland.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sd.png +0 -0
- data/vendor/extensions/localization/public/images/flags/se.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sh.png +0 -0
- data/vendor/extensions/localization/public/images/flags/si.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sj.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sl.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/so.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/st.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sv.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sy.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/td.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/th.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tj.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tl.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/to.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tv.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ua.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ug.png +0 -0
- data/vendor/extensions/localization/public/images/flags/um.png +0 -0
- data/vendor/extensions/localization/public/images/flags/us.png +0 -0
- data/vendor/extensions/localization/public/images/flags/uy.png +0 -0
- data/vendor/extensions/localization/public/images/flags/uz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/va.png +0 -0
- data/vendor/extensions/localization/public/images/flags/vc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ve.png +0 -0
- data/vendor/extensions/localization/public/images/flags/vg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/vi.png +0 -0
- data/vendor/extensions/localization/public/images/flags/vn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/vu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/wales.png +0 -0
- data/vendor/extensions/localization/public/images/flags/wf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ws.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ye.png +0 -0
- data/vendor/extensions/localization/public/images/flags/yt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/za.png +0 -0
- data/vendor/extensions/localization/public/images/flags/zm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/zw.png +0 -0
- data/vendor/extensions/localization/spec/controllers/admin/localization_controller_spec.rb +0 -10
- data/vendor/extensions/localization/spec/controllers/locale_controller_spec.rb +0 -35
- data/vendor/extensions/localization/spec/helpers/locale_helper_spec.rb +0 -5
- data/vendor/extensions/localization/spec/helpers/localization_helper_spec.rb +0 -5
- data/vendor/extensions/localization/spec/spec.opts +0 -6
- data/vendor/extensions/localization/spec/spec_helper.rb +0 -37
- data/vendor/extensions/payment_gateway/app/models/gateway/protx.rb +0 -9
- data/vendor/extensions/theme_default/app/views/admin/taxonomies/_manage_products.rhtml +0 -31
- data/vendor/extensions/theme_default/app/views/admin/taxonomies/_success.rhtml +0 -1
@@ -14,7 +14,7 @@ class Admin::PaymentsController < Admin::BaseController
|
|
14
14
|
return
|
15
15
|
end
|
16
16
|
|
17
|
-
begin
|
17
|
+
begin
|
18
18
|
|
19
19
|
if @order.checkout.state == "complete"
|
20
20
|
object.process!
|
@@ -25,7 +25,7 @@ class Admin::PaymentsController < Admin::BaseController
|
|
25
25
|
until @order.checkout.state == "complete"
|
26
26
|
@order.checkout.next!
|
27
27
|
end
|
28
|
-
|
28
|
+
self.notice = t('new_order_completed')
|
29
29
|
redirect_to admin_order_url(@order)
|
30
30
|
end
|
31
31
|
|
@@ -42,21 +42,21 @@ class Admin::PaymentsController < Admin::BaseController
|
|
42
42
|
Payment.transaction do
|
43
43
|
@payment.source.send("#{event}", @payment)
|
44
44
|
end
|
45
|
-
|
45
|
+
self.notice = t('payment_updated')
|
46
46
|
rescue Spree::GatewayError => ge
|
47
47
|
flash[:error] = "#{ge.message}"
|
48
48
|
ensure
|
49
49
|
redirect_to collection_path
|
50
|
-
end
|
50
|
+
end
|
51
51
|
|
52
52
|
def finalize
|
53
53
|
object.finalize!
|
54
54
|
redirect_to collection_path
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
private
|
58
58
|
|
59
|
-
def object
|
59
|
+
def object
|
60
60
|
@object ||= Payment.find(param) unless param.nil?
|
61
61
|
@object
|
62
62
|
end
|
@@ -70,7 +70,7 @@ class Admin::PaymentsController < Admin::BaseController
|
|
70
70
|
|
71
71
|
def load_data
|
72
72
|
load_object
|
73
|
-
@payment_methods = PaymentMethod.available
|
73
|
+
@payment_methods = PaymentMethod.available(:back_end)
|
74
74
|
if object and object.payment_method
|
75
75
|
@payment_method = object.payment_method
|
76
76
|
else
|
@@ -13,8 +13,6 @@ class Admin::ProductsController < Admin::BaseController
|
|
13
13
|
|
14
14
|
update.before :update_before
|
15
15
|
|
16
|
-
create.before :create_before
|
17
|
-
|
18
16
|
create.response do |wants|
|
19
17
|
# go to edit form after creating as new product
|
20
18
|
wants.html {redirect_to edit_admin_product_url(Product.find(@product.id)) }
|
@@ -38,9 +36,9 @@ class Admin::ProductsController < Admin::BaseController
|
|
38
36
|
end
|
39
37
|
|
40
38
|
if @product.save
|
41
|
-
|
39
|
+
self.notice = I18n.t("notice_messages.product_deleted")
|
42
40
|
else
|
43
|
-
|
41
|
+
self.notice = I18n.t("notice_messages.product_not_deleted")
|
44
42
|
end
|
45
43
|
|
46
44
|
respond_to do |format|
|
@@ -54,9 +52,9 @@ class Admin::ProductsController < Admin::BaseController
|
|
54
52
|
@new = @product.duplicate
|
55
53
|
|
56
54
|
if @new.save
|
57
|
-
|
55
|
+
self.notice = I18n.t("notice_messages.product_cloned")
|
58
56
|
else
|
59
|
-
|
57
|
+
self.notice = I18n.t("notice_messages.product_not_cloned")
|
60
58
|
end
|
61
59
|
|
62
60
|
redirect_to edit_admin_product_url(@new)
|
@@ -69,9 +67,9 @@ class Admin::ProductsController < Admin::BaseController
|
|
69
67
|
end
|
70
68
|
|
71
69
|
def collection
|
72
|
-
|
73
|
-
base_scope = end_of_association_chain
|
70
|
+
base_scope = end_of_association_chain
|
74
71
|
|
72
|
+
unless request.xhr?
|
75
73
|
# Note: the SL scopes are on/off switches, so we need to select "not_deleted" explicitly if the switch is off
|
76
74
|
# QUERY - better as named scope or as SL scope?
|
77
75
|
if params[:search].nil? || params[:search][:deleted_at_not_null].blank?
|
@@ -81,29 +79,20 @@ class Admin::ProductsController < Admin::BaseController
|
|
81
79
|
@search = base_scope.group_by_products_id.searchlogic(params[:search])
|
82
80
|
@search.order ||= "ascend_by_name"
|
83
81
|
|
84
|
-
@collection = @search.paginate(:include
|
85
|
-
:per_page
|
86
|
-
:page
|
82
|
+
@collection = @search.paginate(:include => {:variants => [:images, :option_values]},
|
83
|
+
:per_page => Spree::Config[:admin_products_per_page],
|
84
|
+
:page => params[:page])
|
87
85
|
else
|
88
|
-
|
89
|
-
:conditions => ["name like ?", "%#{params[:q]}%"],
|
90
|
-
:include => [{:variants => [:images, {:option_values => :option_type}]}, :master, :images])
|
86
|
+
includes = [{:variants => [:images, {:option_values => :option_type}]}, :master, :images]
|
91
87
|
|
92
|
-
@collection
|
93
|
-
|
94
|
-
:include => [{:variants => [:images, {:option_values => :option_type}]}, :master, :images])
|
88
|
+
@collection = base_scope.name_contains(params[:q]).all(:include => includes, :limit => 10)
|
89
|
+
@collection.concat base_scope.group_by_products_id.variants_including_master_sku_contains(params[:q]).all(:include => includes, :limit => 10)
|
95
90
|
|
96
91
|
@collection.uniq!
|
97
92
|
end
|
98
93
|
|
99
94
|
end
|
100
95
|
|
101
|
-
# set the default tax_category if applicable
|
102
|
-
def create_before
|
103
|
-
return unless Spree::Config[:default_tax_category]
|
104
|
-
@product.tax_category ||= TaxCategory.find_by_name Spree::Config[:default_tax_category]
|
105
|
-
end
|
106
|
-
|
107
96
|
def update_before
|
108
97
|
# note: we only reset the product properties if we're receiving a post from the form on that tab
|
109
98
|
return unless params[:clear_product_properties]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Admin::ReportsController < Admin::BaseController
|
2
|
-
before_filter :load_data
|
3
|
-
|
2
|
+
before_filter :load_data
|
3
|
+
|
4
4
|
AVAILABLE_REPORTS = {
|
5
5
|
:sales_total => {:name => "Sales Total", :description => "Sales Total For All Orders"}
|
6
6
|
}
|
@@ -8,15 +8,27 @@ class Admin::ReportsController < Admin::BaseController
|
|
8
8
|
def index
|
9
9
|
@reports = AVAILABLE_REPORTS
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def sales_total
|
13
|
+
params[:search] = {} unless params[:search]
|
14
|
+
|
15
|
+
if params[:search][:created_at_after].blank?
|
16
|
+
params[:search][:created_at_after] = Time.zone.now.beginning_of_month
|
17
|
+
else
|
18
|
+
params[:search][:created_at_after] = Time.zone.parse(params[:search][:created_at_after]).beginning_of_day rescue Time.zone.now.beginning_of_month
|
19
|
+
end
|
20
|
+
|
21
|
+
if params[:search] && !params[:search][:created_at_before].blank?
|
22
|
+
params[:search][:created_at_before] = Time.zone.parse(params[:search][:created_at_before]).end_of_day rescue ""
|
23
|
+
end
|
24
|
+
|
13
25
|
|
14
26
|
@search = Order.searchlogic(params[:search])
|
15
27
|
@search.checkout_complete = true
|
16
28
|
#set order by to default or form result
|
17
29
|
@search.order ||= "descend_by_created_at"
|
18
|
-
|
19
|
-
@orders = @search.find(:all)
|
30
|
+
|
31
|
+
@orders = @search.find(:all)
|
20
32
|
|
21
33
|
@item_total = @search.sum(:item_total)
|
22
34
|
@charge_total = @search.sum(:adjustment_total)
|
@@ -24,9 +36,9 @@ class Admin::ReportsController < Admin::BaseController
|
|
24
36
|
@sales_total = @search.sum(:total)
|
25
37
|
end
|
26
38
|
|
27
|
-
private
|
39
|
+
private
|
28
40
|
def load_data
|
29
41
|
|
30
|
-
end
|
42
|
+
end
|
31
43
|
|
32
44
|
end
|
@@ -16,7 +16,7 @@ class Admin::ReturnAuthorizationsController < Admin::BaseController
|
|
16
16
|
def fire
|
17
17
|
load_object
|
18
18
|
@return_authorization.send("#{params[:e]}!")
|
19
|
-
|
19
|
+
self.notice = t('return_authorization_updated')
|
20
20
|
redirect_to :back
|
21
21
|
end
|
22
22
|
|
@@ -7,7 +7,7 @@ class Admin::ShipmentsController < Admin::BaseController
|
|
7
7
|
|
8
8
|
update.wants.html do
|
9
9
|
if @order.in_progress?
|
10
|
-
redirect_to
|
10
|
+
redirect_to admin_order_adjustments_url(@order)
|
11
11
|
else
|
12
12
|
redirect_to edit_object_url
|
13
13
|
end
|
@@ -29,16 +29,17 @@ class Admin::ShipmentsController < Admin::BaseController
|
|
29
29
|
|
30
30
|
def fire
|
31
31
|
@shipment.send("#{params[:e]}!")
|
32
|
-
|
32
|
+
self.notice = t('shipment_updated')
|
33
33
|
redirect_to :back
|
34
34
|
end
|
35
35
|
|
36
36
|
private
|
37
37
|
def build_object
|
38
|
-
@object ||= end_of_association_chain.send parent? ? :build : :new
|
38
|
+
@object ||= end_of_association_chain.send parent? ? :build : :new
|
39
39
|
@object.address ||= @order.ship_address
|
40
40
|
@object.address ||= Address.new(:country_id => Spree::Config[:default_country_id])
|
41
41
|
@object.shipping_method ||= @order.shipping_method
|
42
|
+
@object.attributes = object_params
|
42
43
|
@object
|
43
44
|
end
|
44
45
|
|
@@ -59,17 +60,16 @@ class Admin::ShipmentsController < Admin::BaseController
|
|
59
60
|
end
|
60
61
|
|
61
62
|
def update_after # copy back to order if instructions are enabled
|
62
|
-
if Spree::Config[:shipping_instructions]
|
63
|
-
|
64
|
-
|
65
|
-
end
|
63
|
+
@order.checkout.special_instructions = object_params[:special_instructions] if Spree::Config[:shipping_instructions]
|
64
|
+
@order.checkout.shipping_method = @order.shipment.shipping_method
|
65
|
+
@order.save
|
66
66
|
recalculate_order
|
67
67
|
end
|
68
68
|
|
69
69
|
def assign_inventory_units
|
70
70
|
return unless params.has_key? :inventory_units
|
71
|
-
|
72
|
-
params[:inventory_units].
|
71
|
+
#params[:inventory_units].each { |id, value| @shipment.inventory_units << InventoryUnit.find(id) }
|
72
|
+
@shipment.inventory_unit_ids = params[:inventory_units].keys
|
73
73
|
end
|
74
74
|
|
75
75
|
def recalculate_order
|
@@ -9,6 +9,8 @@ class Admin::UsersController < Admin::BaseController
|
|
9
9
|
wants.html { render :action => :index }
|
10
10
|
wants.json { render :json => @collection.to_json(:include => {:bill_address => {:include => [:state, :country]}, :ship_address => {:include => [:state, :country]}}) }
|
11
11
|
end
|
12
|
+
|
13
|
+
destroy.success.wants.js { render_js_for_destroy }
|
12
14
|
|
13
15
|
private
|
14
16
|
def collection
|
@@ -31,7 +33,7 @@ class Admin::UsersController < Admin::BaseController
|
|
31
33
|
OR addresses.firstname like :search
|
32
34
|
OR addresses.lastname like :search
|
33
35
|
OR ship_addresses_users.firstname like :search
|
34
|
-
OR ship_addresses_users.lastname like :search", {:search => "
|
36
|
+
OR ship_addresses_users.lastname like :search", {:search => "#{params[:q].strip}%"}], :limit => 20)
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
@@ -25,9 +25,9 @@ class Admin::VariantsController < Admin::BaseController
|
|
25
25
|
|
26
26
|
@variant.deleted_at = Time.now()
|
27
27
|
if @variant.save
|
28
|
-
|
28
|
+
self.notice = I18n.t("notice_messages.variant_deleted")
|
29
29
|
else
|
30
|
-
|
30
|
+
self.notice = I18n.t("notice_messages.variant_not_deleted")
|
31
31
|
end
|
32
32
|
|
33
33
|
respond_to do |format|
|
@@ -5,6 +5,7 @@ class CheckoutsController < Spree::BaseController
|
|
5
5
|
before_filter :load_data
|
6
6
|
before_filter :set_state
|
7
7
|
before_filter :enforce_registration, :except => :register
|
8
|
+
before_filter :ensure_order_assigned_to_user, :except => :register
|
8
9
|
before_filter :ensure_payment_methods
|
9
10
|
helper :users
|
10
11
|
|
@@ -24,20 +25,20 @@ class CheckoutsController < Spree::BaseController
|
|
24
25
|
update.before :clear_payments_if_in_payment_state
|
25
26
|
|
26
27
|
# customized verison of the standard r_c update method (since we need to handle gateway errors, etc)
|
27
|
-
def update
|
28
|
+
def update
|
28
29
|
load_object
|
29
30
|
|
30
31
|
# call the edit hooks for the current step in case we experience validation failure and need to edit again
|
31
32
|
edit_hooks
|
32
33
|
@checkout.enable_validation_group(@checkout.state.to_sym)
|
33
34
|
@prev_state = @checkout.state
|
34
|
-
|
35
|
+
|
35
36
|
before :update
|
36
37
|
|
37
38
|
begin
|
38
|
-
if
|
39
|
+
if @checkout.update_attributes object_params
|
39
40
|
update_hooks
|
40
|
-
@order.update_totals!
|
41
|
+
@checkout.order.update_totals!
|
41
42
|
after :update
|
42
43
|
next_step
|
43
44
|
if @checkout.completed_at
|
@@ -143,7 +144,8 @@ class CheckoutsController < Spree::BaseController
|
|
143
144
|
end
|
144
145
|
|
145
146
|
def next_step
|
146
|
-
@checkout.next!
|
147
|
+
@checkout.next!
|
148
|
+
flash[:analytics] = "/checkout/#{object.state}"
|
147
149
|
# call edit hooks for this next step since we're going to just render it (instead of issuing a redirect)
|
148
150
|
edit_hooks
|
149
151
|
end
|
@@ -158,9 +160,9 @@ class CheckoutsController < Spree::BaseController
|
|
158
160
|
@checkout.payments.clear
|
159
161
|
end
|
160
162
|
end
|
161
|
-
|
162
|
-
def load_available_payment_methods
|
163
|
-
@payment_methods = PaymentMethod.available
|
163
|
+
|
164
|
+
def load_available_payment_methods
|
165
|
+
@payment_methods = PaymentMethod.available(:front_end)
|
164
166
|
if @checkout.payment and @checkout.payment.payment_method
|
165
167
|
@payment_method = @checkout.payment.payment_method
|
166
168
|
else
|
@@ -174,17 +176,17 @@ class CheckoutsController < Spree::BaseController
|
|
174
176
|
|
175
177
|
def complete_order
|
176
178
|
if @checkout.order.out_of_stock_items.empty?
|
177
|
-
|
179
|
+
self.notice = t('order_processed_successfully')
|
178
180
|
else
|
179
|
-
|
180
|
-
|
181
|
+
self.notice = t('order_processed_but_following_items_are_out_of_stock')
|
182
|
+
self.notice += '<ul>'
|
181
183
|
@checkout.order.out_of_stock_items.each do |item|
|
182
|
-
|
184
|
+
self.notice += '<li>' + t(:count_of_reduced_by,
|
183
185
|
:name => item[:line_item].variant.name,
|
184
186
|
:count => item[:count]) +
|
185
187
|
'</li>'
|
186
188
|
end
|
187
|
-
|
189
|
+
self.notice += '<ul>'
|
188
190
|
end
|
189
191
|
end
|
190
192
|
|
@@ -194,8 +196,9 @@ class CheckoutsController < Spree::BaseController
|
|
194
196
|
@checkout.shipment.shipping_method = ship_method
|
195
197
|
{ :id => ship_method.id,
|
196
198
|
:name => ship_method.name,
|
197
|
-
:
|
198
|
-
|
199
|
+
:cost => ship_method.calculate_cost(@checkout.shipment)
|
200
|
+
}
|
201
|
+
end.sort_by{|r| r[:cost]}
|
199
202
|
rescue Spree::ShippingError => ship_error
|
200
203
|
flash[:error] = ship_error.to_s
|
201
204
|
[]
|
@@ -212,13 +215,21 @@ class CheckoutsController < Spree::BaseController
|
|
212
215
|
def accurate_title
|
213
216
|
I18n.t(:checkout)
|
214
217
|
end
|
215
|
-
|
218
|
+
|
216
219
|
def ensure_payment_methods
|
217
|
-
if PaymentMethod.available.none?
|
220
|
+
if PaymentMethod.available(:front_end).none?
|
218
221
|
flash[:error] = t(:no_payment_methods_available)
|
219
222
|
redirect_to edit_order_path(params[:order_id])
|
220
223
|
false
|
221
224
|
end
|
222
225
|
end
|
223
|
-
|
226
|
+
|
227
|
+
# Make sure that the order is assigned to the current user if logged in
|
228
|
+
def ensure_order_assigned_to_user
|
229
|
+
load_object
|
230
|
+
if current_user and @order.user != current_user
|
231
|
+
@order.update_attribute(:user, current_user)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
224
235
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class ContentController < Spree::BaseController
|
2
2
|
rescue_from ActionView::MissingTemplate, :with => :render_404
|
3
|
-
caches_page :show, :index
|
3
|
+
caches_page :show, :index, :if => Proc.new { Spree::Config[:cache_static_content] }
|
4
4
|
|
5
5
|
def show
|
6
6
|
render :action => params[:path].join('/')
|
@@ -7,7 +7,7 @@ class LocaleController < ApplicationController
|
|
7
7
|
if params[:locale] && AVAILABLE_LOCALES.include?(params[:locale])
|
8
8
|
I18n.locale = params[:locale]
|
9
9
|
session[:locale] = params[:locale]
|
10
|
-
|
10
|
+
self.notice = t("locale_changed")
|
11
11
|
else
|
12
12
|
flash[:error] = t("locale_not_changed")
|
13
13
|
end
|
@@ -1,34 +1,38 @@
|
|
1
|
-
class OrdersController < Spree::BaseController
|
1
|
+
class OrdersController < Spree::BaseController
|
2
2
|
prepend_before_filter :reject_unknown_object, :only => [:show, :edit, :update, :checkout]
|
3
|
-
before_filter :prevent_editing_complete_order, :only => [:edit, :update, :checkout]
|
3
|
+
before_filter :prevent_editing_complete_order, :only => [:edit, :update, :checkout]
|
4
4
|
before_filter :set_user
|
5
5
|
|
6
6
|
ssl_required :show
|
7
7
|
|
8
8
|
resource_controller
|
9
|
-
|
10
|
-
|
9
|
+
|
11
10
|
helper :products
|
12
11
|
|
13
12
|
create.before :create_before
|
14
13
|
|
15
14
|
# override the default r_c behavior (remove flash - redirect to edit details instead of show)
|
16
15
|
create do
|
17
|
-
flash nil
|
18
|
-
|
19
|
-
|
20
|
-
end
|
16
|
+
flash nil
|
17
|
+
success.wants.html {redirect_to edit_order_url(@order)}
|
18
|
+
failure.wants.html { render :template => "orders/edit" }
|
19
|
+
end
|
20
|
+
|
21
|
+
update.before do
|
22
|
+
# Temporary workaround for problem in Rails 2.3.8 where updating with nested attributes doesn't work if the collection isn't loaded
|
23
|
+
object.line_items(true)
|
24
|
+
end
|
21
25
|
|
22
26
|
# override the default r_c flash behavior
|
23
|
-
update do
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
|
27
|
+
update do
|
28
|
+
flash nil
|
29
|
+
success.wants.html { redirect_to edit_order_url(object) }
|
30
|
+
failure.wants.html { render :template => "orders/edit" }
|
31
|
+
end
|
32
|
+
|
29
33
|
#override r_c default b/c we don't want to actually destroy, we just want to clear line items
|
30
34
|
def destroy
|
31
|
-
|
35
|
+
self.notice = I18n.t(:basket_successfully_cleared)
|
32
36
|
@order.line_items.clear
|
33
37
|
@order.update_totals!
|
34
38
|
after :destroy
|
@@ -37,32 +41,32 @@ class OrdersController < Spree::BaseController
|
|
37
41
|
end
|
38
42
|
|
39
43
|
destroy.response do |wants|
|
40
|
-
wants.html { redirect_to(edit_object_url) }
|
44
|
+
wants.html { redirect_to(edit_object_url) }
|
41
45
|
end
|
42
|
-
|
46
|
+
|
43
47
|
def can_access?
|
44
|
-
return true unless order = load_object
|
48
|
+
return true unless order = load_object
|
45
49
|
session[:order_token] ||= params[:order_token]
|
46
50
|
order.grant_access?(session[:order_token])
|
47
51
|
end
|
48
|
-
|
52
|
+
|
49
53
|
private
|
50
54
|
def build_object
|
51
55
|
@object ||= find_order
|
52
56
|
end
|
53
|
-
|
57
|
+
|
54
58
|
def object
|
55
59
|
@object ||= Order.find_by_number(params[:id], :include => :adjustments) if params[:id]
|
56
60
|
return @object || find_order
|
57
61
|
end
|
58
|
-
|
62
|
+
|
59
63
|
def create_before
|
60
64
|
params[:products].each do |product_id,variant_id|
|
61
65
|
quantity = params[:quantity].to_i if !params[:quantity].is_a?(Array)
|
62
66
|
quantity = params[:quantity][variant_id].to_i if params[:quantity].is_a?(Array)
|
63
67
|
@order.add_variant(Variant.find(variant_id), quantity) if quantity > 0
|
64
68
|
end if params[:products]
|
65
|
-
|
69
|
+
|
66
70
|
params[:variants].each do |variant_id, quantity|
|
67
71
|
quantity = quantity.to_i
|
68
72
|
@order.add_variant(Variant.find(variant_id), quantity) if quantity > 0
|
@@ -71,21 +75,20 @@ class OrdersController < Spree::BaseController
|
|
71
75
|
# store order token in the session
|
72
76
|
session[:order_token] = @order.token
|
73
77
|
end
|
74
|
-
|
75
|
-
def prevent_editing_complete_order
|
78
|
+
|
79
|
+
def prevent_editing_complete_order
|
76
80
|
load_object
|
77
81
|
redirect_to object_url if @order.checkout_complete
|
78
82
|
end
|
79
|
-
|
83
|
+
|
80
84
|
def set_user
|
81
|
-
if
|
82
|
-
|
83
|
-
|
84
|
-
end
|
85
|
+
#only if the user is blank and the order is in_progress
|
86
|
+
if @order && @order.user.nil? && @order.in_progress?
|
87
|
+
@order.checkout.update_attribute(:email, current_user && current_user.email) if @order.checkout
|
85
88
|
@order.update_attribute(:user, current_user)
|
86
89
|
end
|
87
90
|
end
|
88
|
-
|
91
|
+
|
89
92
|
def accurate_title
|
90
93
|
I18n.t(:shopping_cart)
|
91
94
|
end
|