Project

General

Profile

Feature #9995 » new_time_entries_cancel-create_and_continue.diff

Jérôme BATAILLE, 2012-01-13 18:32

View differences:

app/controllers/timelog_controller.rb (copie de travail)
150 150

  
151 151
  verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
152 152
  def create
153
    if params[:cancel].present?
154
      redirect_to :action => 'index', :project_id => @project, :issue_id => @issue
155
      return
156
    end
157

  
153 158
    @time_entry ||= TimeEntry.new(:project => @project, :user => User.current, :issue => @issue, :spent_on => User.current.today)
154 159
    if params[:time_entry].include?(:user_id)
155 160
      if params[:time_entry][:user_id].blank?
......
178 183
      respond_to do |format|
179 184
        format.html {
180 185
          flash[:notice] = l(:notice_successful_update)
181
          redirect_back_or_default :action => 'index', :project_id => @time_entry.project
186
          if params[:continue].blank? || params[:continue] != '1'
187
            redirect_back_or_default :action => 'index', :project_id => @time_entry.project
188
          else
189
            if @time_entry.comments.present?
190
              flash[:notice] = flash[:notice] + " (#{@time_entry.comments})"
191
            end
192
            redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue
193
          end
182 194
        }
183 195
        format.api  { render :action => 'show', :status => :created, :location => time_entry_url(@time_entry) }
184 196
      end
app/views/timelog/edit.rhtml (copie de travail)
52 52
</div>
53 53

  
54 54
<%= submit_tag l(:button_save) %>
55

  
56
<% end %>
55
<%
56
  if controller.action_name == 'new'
57
-%>
58
<%= check_box_tag 'continue' %> <%= l(:button_create_and_continue) %>
59
<%
60
  end
61
end
62
-%>
63
<br/>
64
<%= submit_tag l(:button_cancel), :name => 'cancel' %>
    (1-1/1)