Shift legacy redirect further down routes to avoid stomping /enterprises/check_permalink

This commit is contained in:
Rohan Mitchell
2015-07-10 09:40:42 +10:00
parent 4cc8eb90fc
commit 73b90dba10
3 changed files with 4 additions and 2 deletions

View File

@@ -241,7 +241,7 @@ module Admin
# Overriding method on Spree's resource controller
def location_after_save
referer_path = OpenFoodNetwork::RefererParser::path(request.referer)
refered_from_edit = referer_path == main_app.edit_admin_enterprise_path(@enterprise)
refered_from_edit = referer_path =~ /\/edit$/
if params[:enterprise].key?(:producer_properties_attributes) && !refered_from_edit
main_app.admin_enterprises_path
else

View File

@@ -3,7 +3,6 @@ Openfoodnetwork::Application.routes.draw do
# Redirects from old URLs avoid server errors and helps search engines
get "/enterprises", to: redirect("/")
get "/enterprises/:permalink", to: redirect("/")
get "/products", to: redirect("/")
get "/t/products/:id", to: redirect("/")
get "/about_us", to: redirect(ContentConfig.footer_about_url)
@@ -55,6 +54,7 @@ Openfoodnetwork::Application.routes.draw do
end
end
get '/:id/shop', to: 'enterprises#shop', as: 'enterprise_shop'
get "/enterprises/:permalink", to: redirect("/") # Legacy enterprise URL
devise_for :enterprise, controllers: { confirmations: 'enterprise_confirmations' }

View File

@@ -78,6 +78,8 @@ feature %q{
end
fill_in 'enterprise_name', :with => 'Eaterprises'
fill_in 'enterprise_permalink', with: 'eaterprises-permalink'
page.should have_selector '.available'
choose 'Own'
within (".side_menu") { click_link "Users" }