summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-04-16 17:27:53 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-04-16 17:27:53 +0000
commit1a4f81163d2c66e9827d674d32066865ef7e4bd0 (patch)
tree710b3fe84c2410b0a95dd83635931b3f4c420384 /app
parent7061f73708336881660c763aa535c9b327610c70 (diff)
downloadredmine-1a4f81163d2c66e9827d674d32066865ef7e4bd0.tar.gz
redmine-1a4f81163d2c66e9827d674d32066865ef7e4bd0.zip
Redirected user to where he is coming from after logging hours (#1062).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1354 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/timelog_controller.rb2
-rw-r--r--app/helpers/application_helper.rb4
-rw-r--r--app/views/timelog/edit.rhtml1
3 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb
index 2c90093bd..29c2635d6 100644
--- a/app/controllers/timelog_controller.rb
+++ b/app/controllers/timelog_controller.rb
@@ -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')
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index eb8cc2795..47a251053 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -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)") +
" | " +
diff --git a/app/views/timelog/edit.rhtml b/app/views/timelog/edit.rhtml
index e221038a0..f9dae8a99 100644
--- a/app/views/timelog/edit.rhtml
+++ b/app/views/timelog/edit.rhtml
@@ -2,6 +2,7 @@
<% labelled_tabular_form_for :time_entry, @time_entry, :url => {:action => 'edit', :project_id => @time_entry.project} do |f| %>
<%= error_messages_for 'time_entry' %>
+<%= back_url_hidden_field_tag %>
<div class="box">
<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>