diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller.rb similarity index 92% rename from app/controllers/spree/checkout_controller_decorator.rb rename to app/controllers/spree/checkout_controller.rb index 88d2268545..3d7dafa898 100644 --- a/app/controllers/spree/checkout_controller_decorator.rb +++ b/app/controllers/spree/checkout_controller.rb @@ -1,6 +1,6 @@ require 'open_food_network/address_finder' -Spree::CheckoutController.class_eval do +class Spree::CheckoutController < Spree::StoreController include CheckoutHelper before_filter :enable_embedded_shopfront diff --git a/app/controllers/spree/orders_controller_decorator.rb b/app/controllers/spree/orders_controller.rb similarity index 99% rename from app/controllers/spree/orders_controller_decorator.rb rename to app/controllers/spree/orders_controller.rb index aa40dde4a6..f7f301d2fa 100644 --- a/app/controllers/spree/orders_controller_decorator.rb +++ b/app/controllers/spree/orders_controller.rb @@ -1,7 +1,7 @@ require 'spree/core/controller_helpers/order_decorator' require 'spree/core/controller_helpers/auth_decorator' -Spree::OrdersController.class_eval do +class Spree::OrdersController < Spree::StoreController before_filter :update_distribution, only: :update before_filter :filter_order_params, only: :update before_filter :enable_embedded_shopfront diff --git a/app/controllers/spree/store_controller_decorator.rb b/app/controllers/spree/store_controller.rb similarity index 74% rename from app/controllers/spree/store_controller_decorator.rb rename to app/controllers/spree/store_controller.rb index 029a617aac..00f4183fbb 100644 --- a/app/controllers/spree/store_controller_decorator.rb +++ b/app/controllers/spree/store_controller.rb @@ -1,4 +1,4 @@ -class Spree::StoreController +class Spree::StoreController < Spree::BaseController layout 'darkswarm' include I18nHelper diff --git a/config/routes/spree.rb b/config/routes/spree.rb index 9407e38701..f2c251caac 100644 --- a/config/routes/spree.rb +++ b/config/routes/spree.rb @@ -86,4 +86,41 @@ Spree::Core::Engine.routes.prepend do get :order_cycle_expired, :on => :collection put :cancel, on: :member end + + root :to => 'home#index' + + resources :products + + match '/locale/set', :to => 'locale#set' + + resources :states, :only => :index + resources :countries, :only => :index + + # non-restful checkout stuff + put '/checkout/update/:state', :to => 'checkout#update', :as => :update_checkout + get '/checkout/:state', :to => 'checkout#edit', :as => :checkout_state + get '/checkout', :to => 'checkout#edit' , :as => :checkout + + populate_redirect = redirect do |params, request| + request.flash[:error] = Spree.t(:populate_get_error) + request.referer || '/cart' + end + + get '/orders/populate', :via => :get, :to => populate_redirect + match '/orders/:id/token/:token' => 'orders#show', :via => :get, :as => :token_order + + resources :orders do + post :populate, :on => :collection + end + + get '/cart', :to => 'orders#edit', :as => :cart + put '/cart', :to => 'orders#update', :as => :update_cart + put '/cart/empty', :to => 'orders#empty', :as => :empty_cart + + # route globbing for pretty nested taxon and product paths + match '/t/*id', :to => 'taxons#show', :as => :nested_taxons + + match '/unauthorized', :to => 'home#unauthorized', :as => :unauthorized + match '/content/cvv', :to => 'content#cvv', :as => :cvv + match '/content/*path', :to => 'content#show', :via => :get, :as => :content end