]> source.dussan.org Git - redmine.git/commitdiff
Redirected user to where he is coming from after logging hours (#1062).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 16 Apr 2008 17:27:53 +0000 (17:27 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 16 Apr 2008 17:27:53 +0000 (17:27 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1354 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/timelog_controller.rb
app/helpers/application_helper.rb
app/views/timelog/edit.rhtml

index 2c90093bd9d46ca1f36aa74543b5389a8335d35c..29c2635d6273159e315925f73bac37cf509597b2 100644 (file)
@@ -172,7 +172,7 @@ class TimelogController < ApplicationController
     @time_entry.attributes = params[:time_entry]
     if request.post? and @time_entry.save
       flash[:notice] = l(:notice_successful_update)
-      redirect_to :action => 'details', :project_id => @time_entry.project
+      redirect_to(params[:back_url] || {:action => 'details', :project_id => @time_entry.project})
       return
     end    
     @activities = Enumeration::get_values('ACTI')
index eb8cc2795b9da265c14d44d821218b5e760d6204..47a25105352059fc731de1520dab764f4f8e3606 100644 (file)
@@ -427,6 +427,10 @@ module ApplicationHelper
     form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc)
   end
   
+  def back_url_hidden_field_tag
+    hidden_field_tag 'back_url', (params[:back_url] || request.env['HTTP_REFERER'])
+  end
+  
   def check_all_links(form_name)
     link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") +
     " | " +
index e221038a0e82a6bc4a5969206ad02214b16e93c4..f9dae8a991ef60901a9a78a26d9cd11b14144957 100644 (file)
@@ -2,6 +2,7 @@
 \r
 <% labelled_tabular_form_for :time_entry, @time_entry, :url => {:action => 'edit', :project_id => @time_entry.project} do |f| %>\r
 <%= error_messages_for 'time_entry' %>\r
+<%= back_url_hidden_field_tag %>\r
 \r
 <div class="box">\r
 <p><%= f.text_field :issue_id, :size => 6 %> <em><%= h("#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}") if @time_entry.issue %></em></p>\r