From cf5658d7fe04a648f50547162d4594d60d8a47c3 Mon Sep 17 00:00:00 2001
From: Jean-Philippe Lang <jp_lang@yahoo.fr>
Date: Tue, 10 Feb 2009 17:18:19 +0000
Subject: [PATCH] Fixes broken action url on time edit form (#2707).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2434 e93f8b46-1217-0410-a6f0-8f06a7374b81
---
 app/views/timelog/edit.rhtml               | 2 +-
 test/functional/timelog_controller_test.rb | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/app/views/timelog/edit.rhtml b/app/views/timelog/edit.rhtml
index c403d8f25..085f3d805 100644
--- a/app/views/timelog/edit.rhtml
+++ b/app/views/timelog/edit.rhtml
@@ -1,6 +1,6 @@
 <h2><%= l(:label_spent_time) %></h2>
 
-<% labelled_tabular_form_for :time_entry, @time_entry, :url => {:action => 'edit', :project_id => @time_entry.project} do |f| %>
+<% labelled_tabular_form_for :time_entry, @time_entry, :url => {:action => 'edit', :id => @time_entry, :project_id => @time_entry.project} do |f| %>
 <%= error_messages_for 'time_entry' %>
 <%= back_url_hidden_field_tag %>
 
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index f2d0f3141..46c3f3ef8 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -62,6 +62,15 @@ class TimelogControllerTest < Test::Unit::TestCase
                                  :content => 'Development'
   end
   
+  def test_get_edit_existing_time
+    @request.session[:user_id] = 2
+    get :edit, :id => 2, :project_id => nil
+    assert_response :success
+    assert_template 'edit'
+    # Default activity selected
+    assert_tag :tag => 'form', :attributes => { :action => '/projects/ecookbook/timelog/edit/2' }
+  end
+  
   def test_post_edit
     # TODO: should POST to issues’ time log instead of project. change form
     # and routing
-- 
GitLab