Skip to content

Commit

Permalink
WIP how to fix routes?
Browse files Browse the repository at this point in the history
  • Loading branch information
luisramos0 committed Sep 1, 2020
1 parent 720e369 commit 4f8fa2f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
33 changes: 16 additions & 17 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -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("/")
Expand All @@ -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
Expand Down Expand Up @@ -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'
Expand All @@ -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
6 changes: 3 additions & 3 deletions lib/spree/core/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4f8fa2f

Please sign in to comment.