From cf4e7b18b480b3319c35b1450b6234495c886f80 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Wed, 18 Jun 2014 15:43:22 +1000 Subject: [PATCH] Redirect to enterprises index page after updating producer properties --- app/controllers/admin/enterprises_controller.rb | 8 ++++++-- app/views/admin/producer_properties/index.html.haml | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/enterprises_controller.rb b/app/controllers/admin/enterprises_controller.rb index 8327c4f1cc..a4f4eea834 100644 --- a/app/controllers/admin/enterprises_controller.rb +++ b/app/controllers/admin/enterprises_controller.rb @@ -51,9 +51,13 @@ module Admin @enterprise_fees = EnterpriseFee.managed_by(spree_current_user).for_enterprise(@enterprise).order(:fee_type, :name).all end + # Overriding method on Spree's resource controller def location_after_save - # Overriding method on Spree's resource controller - main_app.edit_admin_enterprise_path(@enterprise) + if params[:enterprise].key? :producer_properties_attributes + main_app.admin_enterprises_path + else + main_app.edit_admin_enterprise_path(@enterprise) + end end end end diff --git a/app/views/admin/producer_properties/index.html.haml b/app/views/admin/producer_properties/index.html.haml index b92c191e7d..2b4277b08d 100644 --- a/app/views/admin/producer_properties/index.html.haml +++ b/app/views/admin/producer_properties/index.html.haml @@ -1,4 +1,5 @@ - content_for :page_title do + = "#{@enterprise.name}:" Producer Properties