Redirect user back to enterprise edit page after saving

This commit is contained in:
Rob H
2014-06-18 13:18:33 +10:00
parent 65a0e4707a
commit 6809d70397
2 changed files with 8 additions and 5 deletions

View File

@@ -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

View File

@@ -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