Feature #9995 » new_time_entries_cancel-create_and_continue.diff
| app/controllers/timelog_controller.rb (copie de travail) | ||
|---|---|---|
|
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
|
||
|
def create
|
||
|
if params[:cancel].present?
|
||
|
redirect_to :action => 'index', :project_id => @project, :issue_id => @issue
|
||
|
return
|
||
|
end
|
||
|
@time_entry ||= TimeEntry.new(:project => @project, :user => User.current, :issue => @issue, :spent_on => User.current.today)
|
||
|
if params[:time_entry].include?(:user_id)
|
||
|
if params[:time_entry][:user_id].blank?
|
||
| ... | ... | |
|
respond_to do |format|
|
||
|
format.html {
|
||
|
flash[:notice] = l(:notice_successful_update)
|
||
|
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
|
||
|
if params[:continue].blank? || params[:continue] != '1'
|
||
|
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
|
||
|
else
|
||
|
if @time_entry.comments.present?
|
||
|
flash[:notice] = flash[:notice] + " (#{@time_entry.comments})"
|
||
|
end
|
||
|
redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue
|
||
|
end
|
||
|
}
|
||
|
format.api { render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) }
|
||
|
end
|
||
| app/views/timelog/edit.rhtml (copie de travail) | ||
|---|---|---|
|
</div>
|
||
|
<%= submit_tag l(:button_save) %>
|
||
|
<% end %>
|
||
|
<%
|
||
|
if controller.action_name == 'new'
|
||
|
-%>
|
||
|
<%= check_box_tag 'continue' %> <%= l(:button_create_and_continue) %>
|
||
|
<%
|
||
|
end
|
||
|
end
|
||
|
-%>
|
||
|
<br/>
|
||
|
<%= submit_tag l(:button_cancel), :name => 'cancel' %>
|
||