Project

General

Profile

Patch #14692 » RM_14692_timelog_controller_redirections_tweak.diff

Jérôme BATAILLE, 2013-08-14 16:40

View differences:

timelog_controller.rb (revision 1811)
150 150
      respond_to do |format|
151 151
        format.html {
152 152
          flash[:notice] = l(:notice_successful_update)
153
          redirect_back_or_default :action => 'index', :project_id => @time_entry.project
153
          # Fix : after update redirect to the issue time entries list if possible
154
          redirect_to :action => 'index', :project_id => @time_entry.project, :issue_id => @time_entry.issue_id
154 155
        }
155 156
        format.api  { head :ok }
156 157
      end
......
207 208
    respond_to do |format|
208 209
      format.html {
209 210
        flash[:notice] = l(:notice_successful_delete)
210
        redirect_back_or_default(:action => 'index', :project_id => @projects.first)
211
        # FIX : after deletion, get back to the issue time entries list if not in bulk edit mode
212
        only_time_entry = nil
213
        if @time_entries.present? && (@time_entries.size == 1)
214
          only_time_entry = @time_entries.first
215
        end
216

  
217
        if only_time_entry.present?
218
          redirect_to(:action => 'index', :project_id => only_time_entry.project_id, :issue_id => only_time_entry.issue_id)
219
        else
220
          redirect_back_or_default(:action => 'index', :project_id => @projects.first)
221
        end
222
        # END -- Smile specific FIX : Get back to the time entries for the issue if not in bulk edit mode
211 223
      }
212 224
      format.api  { head :ok }
213 225
    end
    (1-1/1)