@@ -127,8 +127,12 class TimelogController < ApplicationController | |||
|
127 | 127 | if @time_entry.save |
|
128 | 128 | respond_to do |format| |
|
129 | 129 | format.html { |
|
130 |
flash[:notice] = l(:notice_successful_ |
|
|
131 | redirect_back_or_default :action => 'index', :project_id => @time_entry.project | |
|
130 | flash[:notice] = l(:notice_successful_create) | |
|
131 | if params[:continue] | |
|
132 | redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue | |
|
133 | else | |
|
134 | redirect_back_or_default :action => 'index', :project_id => @time_entry.project | |
|
135 | end | |
|
132 | 136 | } |
|
133 | 137 | format.api { render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) } |
|
134 | 138 | end |
@@ -2,5 +2,6 | |||
|
2 | 2 | |
|
3 | 3 | <% labelled_form_for @time_entry, :url => project_time_entries_path(@time_entry.project) do |f| %> |
|
4 | 4 | <%= render :partial => 'form', :locals => {:f => f} %> |
|
5 |
<%= submit_tag l(:button_ |
|
|
5 | <%= submit_tag l(:button_create) %> | |
|
6 | <%= submit_tag l(:button_create_and_continue), :name => 'continue' %> | |
|
6 | 7 | <% end %> |
@@ -119,6 +119,28 class TimelogControllerTest < ActionController::TestCase | |||
|
119 | 119 | assert_equal 3, t.user_id |
|
120 | 120 | end |
|
121 | 121 | |
|
122 | def test_create_and_continue | |
|
123 | @request.session[:user_id] = 2 | |
|
124 | post :create, :project_id => 1, | |
|
125 | :time_entry => {:activity_id => '11', | |
|
126 | :issue_id => '', | |
|
127 | :spent_on => '2008-03-14', | |
|
128 | :hours => '7.3'}, | |
|
129 | :continue => '1' | |
|
130 | assert_redirected_to '/projects/ecookbook/time_entries/new' | |
|
131 | end | |
|
132 | ||
|
133 | def test_create_and_continue_with_issue_id | |
|
134 | @request.session[:user_id] = 2 | |
|
135 | post :create, :project_id => 1, | |
|
136 | :time_entry => {:activity_id => '11', | |
|
137 | :issue_id => '1', | |
|
138 | :spent_on => '2008-03-14', | |
|
139 | :hours => '7.3'}, | |
|
140 | :continue => '1' | |
|
141 | assert_redirected_to '/projects/ecookbook/issues/1/time_entries/new' | |
|
142 | end | |
|
143 | ||
|
122 | 144 | def test_create_without_log_time_permission_should_be_denied |
|
123 | 145 | @request.session[:user_id] = 2 |
|
124 | 146 | Role.find_by_name('Manager').remove_permission! :log_time |
General Comments 0
You need to be logged in to leave comments.
Login now