summaryrefslogtreecommitdiffstats
path: root/app/controllers/timelog_controller.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-10-07 15:51:09 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-10-07 15:51:09 +0000
commit068771ea0764e326d720455c87e6c8cbc0f825a3 (patch)
treea79f34bf8471a43b3d0829507bdfcd8b716eba63 /app/controllers/timelog_controller.rb
parente59156b446f1e402c95d04c39374630f2913b611 (diff)
downloadredmine-068771ea0764e326d720455c87e6c8cbc0f825a3.tar.gz
redmine-068771ea0764e326d720455c87e6c8cbc0f825a3.zip
Refactor: extract TimelogController#new from #edit
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4239 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/timelog_controller.rb')
-rw-r--r--app/controllers/timelog_controller.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb
index bf571aa59..d15ea6a54 100644
--- a/app/controllers/timelog_controller.rb
+++ b/app/controllers/timelog_controller.rb
@@ -17,7 +17,7 @@
class TimelogController < ApplicationController
menu_item :issues
- before_filter :find_project, :authorize, :only => [:edit, :destroy]
+ before_filter :find_project, :authorize, :only => [:new, :edit, :destroy]
before_filter :find_optional_project, :only => [:index]
verify :method => :post, :only => :destroy, :redirect_to => { :action => :index }
@@ -85,6 +85,14 @@ class TimelogController < ApplicationController
end
end
end
+
+ def new
+ @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today)
+ @time_entry.attributes = params[:time_entry]
+
+ call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry })
+ render :action => 'edit'
+ end
def edit
(render_403; return) if @time_entry && !@time_entry.editable_by?(User.current)