diff --git a/app/controllers/admin/data_controller.rb b/app/controllers/admin/data_controller.rb index 7108bb4..e563f8e 100644 --- a/app/controllers/admin/data_controller.rb +++ b/app/controllers/admin/data_controller.rb @@ -26,7 +26,7 @@ def create if @item.save flash[:notice] = t(:saved, :scope => [:app, :admin_general]) end - respond_with(@datum, :location => admin_item_path(@item, :anchor => "datum_#{@datum.id}_edit")) + respond_with(@datum, location: params[:return_to] || admin_item_path(@item, :anchor => "datum_#{@datum.id}_edit")) end def edit @@ -40,7 +40,7 @@ def update if @datum.update_attributes(params[:datum]) format.html do flash[:notice] = t(:saved, :scope => [:app, :admin_items]) - redirect_to admin_item_path(@item, :anchor => "datum_#{@datum.id}") + redirect_to params[:return_to] || admin_item_path(@item, :anchor => "datum_#{@datum.id}") end format.json { render :json => @datum.to_json, :status => :ok } else diff --git a/app/views/admin/data/edit.html.erb b/app/views/admin/data/edit.html.erb index 1ff4e8f..3eadca9 100644 --- a/app/views/admin/data/edit.html.erb +++ b/app/views/admin/data/edit.html.erb @@ -6,6 +6,7 @@