finaly fixed the redirect back

git-svn-id: https://dev.finn.de/svn/cockpit/trunk@110 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
hjust 15 years ago
parent af6f36460d
commit 65ed0a36f8
  1. 4
      app/controllers/cost_types_controller.rb
  2. 2
      app/controllers/hourly_rates_controller.rb

@ -44,7 +44,7 @@ class CostTypesController < ApplicationController
if request.post? && @cost_type.save
flash[:notice] = l(:notice_successful_update)
redirect_to(params[:back_to] || {:action => 'index'})
redirect_back_or_default(:action => 'index')
else
@cost_type.rates.build({:valid_from => Date.today}) if @cost_type.rates.empty?
render :action => "edit", :layout => !request.xhr?
@ -59,7 +59,7 @@ class CostTypesController < ApplicationController
@cost_type.default = false
if request.post? && @cost_type.save
flash[:notice] = @cost_type.deleted_at ? l(:notice_successful_delete) : l(:notice_successful_restore)
redirect_to(params[:back_to] || {:action => 'index'})
redirect_back_or_default(:action => 'index')
end
end

@ -48,7 +48,7 @@ class HourlyRatesController < ApplicationController
if request.post? && @user.save
flash[:notice] = l(:notice_successful_update)
redirect_to(params[:back_url] || {:action => 'show', :id => @user, :project_id => @project})
redirect_back_or_default(:action => 'show', :id => @user, :project_id => @project)
else
@rates = @user.rates.select{|r| r.project_id == @project.id}.sort { |a,b| b.valid_from <=> a.valid_from }
@rates << @user.rates.build({:valid_from => Date.today, :project_id => @project}) if @rates.empty?

Loading…
Cancel
Save