mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-06 22:36:07 +00:00
Redirect user back to enterprise edit page after saving
This commit is contained in:
@@ -2,7 +2,7 @@ module Admin
|
||||
class EnterprisesController < ResourceController
|
||||
before_filter :load_enterprise_set, :only => :index
|
||||
before_filter :load_countries, :except => :index
|
||||
before_filter :load_methods_and_fees, :only => [:new, :edit]
|
||||
before_filter :load_methods_and_fees, :only => [:new, :edit, :update, :create]
|
||||
create.after :grant_management
|
||||
|
||||
helper 'spree/products'
|
||||
@@ -49,5 +49,10 @@ module Admin
|
||||
@shipping_methods = Spree::ShippingMethod.managed_by(spree_current_user).sort_by!{ |sm| [(@enterprise.shipping_methods.include? sm) ? 0 : 1, sm.name] }
|
||||
@enterprise_fees = EnterpriseFee.managed_by(spree_current_user).for_enterprise(@enterprise).order(:fee_type, :name).all
|
||||
end
|
||||
|
||||
def location_after_save
|
||||
# Overriding method on Spree's resource controller
|
||||
main_app.edit_admin_enterprise_path(@enterprise)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -153,9 +153,7 @@ feature %q{
|
||||
click_button 'Update'
|
||||
|
||||
flash_message.should == 'Enterprise "Eaterprises" has been successfully updated!'
|
||||
page.should have_selector '#listing_enterprises a', text: 'Eaterprises'
|
||||
|
||||
click_link 'Edit Profile'
|
||||
page.should have_field 'enterprise_name', :with => 'Eaterprises'
|
||||
|
||||
page.should have_checked_field "enterprise_payment_method_ids_#{payment_method.id}"
|
||||
page.should have_checked_field "enterprise_shipping_method_ids_#{shipping_method.id}"
|
||||
@@ -215,7 +213,7 @@ feature %q{
|
||||
click_button 'Update'
|
||||
|
||||
flash_message.should == 'Enterprise "Eaterprises" has been successfully updated!'
|
||||
page.should have_selector '#listing_enterprises a', text: 'Eaterprises'
|
||||
page.should have_field 'enterprise_name', :with => 'Eaterprises'
|
||||
end
|
||||
|
||||
scenario "Editing images for an enterprise" do
|
||||
|
||||
Reference in New Issue
Block a user