mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-05 02:41:33 +00:00
Move spree frontend routes to ofn and transform decorators with class_eval to controller classes
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
@@ -1,4 +1,4 @@
|
||||
class Spree::StoreController
|
||||
class Spree::StoreController < Spree::BaseController
|
||||
layout 'darkswarm'
|
||||
|
||||
include I18nHelper
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user