From 4f8fa2fb6500acc7b0c0419b4db7eb92076c8aad Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Tue, 1 Sep 2020 20:05:24 +0100 Subject: [PATCH] WIP how to fix routes? --- config/routes.rb | 33 ++++++++++++++++----------------- lib/spree/core/engine.rb | 6 +++--- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index a657f7f234af..3ff99ba57f8d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,5 @@ Openfoodnetwork::Application.routes.draw do - - root :to => 'home#index' + # root :to => 'home#index' # Redirects from old URLs avoid server errors and helps search engines get "/enterprises", to: redirect("/") @@ -9,26 +8,26 @@ get "/about_us", to: redirect(ContentConfig.footer_about_url) get "/login", to: redirect("/#/login") - get '/unauthorized', :to => 'home#unauthorized', :as => :unauthorized + # get '/unauthorized', :to => 'home#unauthorized', :as => :unauthorized get "/discourse/login", to: "discourse_sso#login" get "/discourse/sso", to: "discourse_sso#sso" - get "/map", to: "map#index", as: :map - get "/sell", to: "home#sell", as: :sell + # get "/map", to: "map#index", as: :map + # get "/sell", to: "home#sell", as: :sell - get "/register", to: "registration#index", as: :registration - get "/register/auth", to: "registration#authenticate", as: :registration_auth + # get "/register", to: "registration#index", as: :registration + # get "/register/auth", to: "registration#authenticate", as: :registration_auth post "/user/registered_email", to: "spree/users#registered_email" # Redirects to global website get "/connect", to: redirect("https://openfoodnetwork.org/#{ENV['DEFAULT_COUNTRY_CODE'].andand.downcase}/connect/") get "/learn", to: redirect("https://openfoodnetwork.org/#{ENV['DEFAULT_COUNTRY_CODE'].andand.downcase}/learn/") - get "/cart", :to => "spree/orders#edit", :as => :cart - patch "/cart", :to => "spree/orders#update", :as => :update_cart - put "/cart/empty", :to => 'spree/orders#empty', :as => :empty_cart - get '/orders/:id/token/:token' => 'spree/orders#show', :as => :token_order + #get "/cart", :to => "spree/orders#edit", :as => :cart + #patch "/cart", :to => "spree/orders#update", :as => :update_cart + #put "/cart/empty", :to => 'spree/orders#empty', :as => :empty_cart + #get '/orders/:id/token/:token' => 'spree/orders#show', :as => :token_order resource :cart, controller: "cart" do post :populate @@ -67,9 +66,9 @@ resources :webhooks, only: [:create] end - get '/checkout', :to => 'checkout#edit' , :as => :checkout - put '/checkout', :to => 'checkout#update' , :as => :update_checkout - get '/checkout/paypal_payment/:order_id', to: 'checkout#paypal_payment', as: :paypal_payment + #get '/checkout', :to => 'checkout#edit' , :as => :checkout + #put '/checkout', :to => 'checkout#update' , :as => :update_checkout + #get '/checkout/paypal_payment/:order_id', to: 'checkout#paypal_payment', as: :paypal_payment get 'embedded_shopfront/shopfront_session', to: 'application#shopfront_session' post 'embedded_shopfront/enable', to: 'application#enable_embedded_styles' @@ -86,14 +85,14 @@ get :relatives end end - get '/:id/shop', to: 'enterprises#shop', as: 'enterprise_shop' + #get '/:id/shop', to: 'enterprises#shop', as: 'enterprise_shop' get "/enterprises/:permalink", to: redirect("/") # Legacy enterprise URL get 'sitemap.xml', to: 'sitemap#index', defaults: { format: 'xml' } # Mount DFC API endpoints - mount DfcProvider::Engine, at: '/' + #mount DfcProvider::Engine, at: '/' # Mount Spree's routes - mount Spree::Core::Engine, :at => '/' + #mount Spree::Core::Engine, :at => '/' end diff --git a/lib/spree/core/engine.rb b/lib/spree/core/engine.rb index 30a66922e18a..f28f9395d90a 100644 --- a/lib/spree/core/engine.rb +++ b/lib/spree/core/engine.rb @@ -20,9 +20,9 @@ class Engine < ::Rails::Engine # We reload the routes here # so that the appended/prepended routes are available to the application. - config.after_initialize do - Rails.application.routes_reloader.reload! - end + #config.after_initialize do + # Rails.application.routes_reloader.reload! + #end initializer "spree.environment", before: :load_config_initializers do |app| app.config.spree = Spree::Core::Environment.new