Adds a 'Create and continue' button on the spent time form (#9995).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8687 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
11725be278
commit
1d07bb91a7
|
@ -127,8 +127,12 @@ class TimelogController < ApplicationController
|
|||
if @time_entry.save
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
if params[:continue]
|
||||
redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue
|
||||
else
|
||||
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
|
||||
end
|
||||
}
|
||||
format.api { render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) }
|
||||
end
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
|
||||
<% labelled_form_for @time_entry, :url => project_time_entries_path(@time_entry.project) do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
|
||||
<% end %>
|
||||
|
|
|
@ -119,6 +119,28 @@ class TimelogControllerTest < ActionController::TestCase
|
|||
assert_equal 3, t.user_id
|
||||
end
|
||||
|
||||
def test_create_and_continue
|
||||
@request.session[:user_id] = 2
|
||||
post :create, :project_id => 1,
|
||||
:time_entry => {:activity_id => '11',
|
||||
:issue_id => '',
|
||||
:spent_on => '2008-03-14',
|
||||
:hours => '7.3'},
|
||||
:continue => '1'
|
||||
assert_redirected_to '/projects/ecookbook/time_entries/new'
|
||||
end
|
||||
|
||||
def test_create_and_continue_with_issue_id
|
||||
@request.session[:user_id] = 2
|
||||
post :create, :project_id => 1,
|
||||
:time_entry => {:activity_id => '11',
|
||||
:issue_id => '1',
|
||||
:spent_on => '2008-03-14',
|
||||
:hours => '7.3'},
|
||||
:continue => '1'
|
||||
assert_redirected_to '/projects/ecookbook/issues/1/time_entries/new'
|
||||
end
|
||||
|
||||
def test_create_without_log_time_permission_should_be_denied
|
||||
@request.session[:user_id] = 2
|
||||
Role.find_by_name('Manager').remove_permission! :log_time
|
||||
|
|
Loading…
Reference in New Issue