Project

General

Profile

Defect #11006 » issues_controller.diff

zhiguo Zhu, 2014-05-19 10:27

View differences:

app/controllers/issues_controller.rb
54 54

  
55 55
  def index
56 56
    retrieve_query
57

  
57 58
    sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
58 59
    sort_update(@query.sortable_columns)
59 60
    @query.sort_criteria = sort_criteria.to_a
......
104 105
  end
105 106

  
106 107
  def show
108
    @prev = params[:prev]
109
    @next = params[:next]
110
    @pos  = params[:pos]
111
    @count = params[:count]
112

  
107 113
    @journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all
108 114
    @journals.each_with_index {|j,i| j.indice = i+1}
109 115
    @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
......
182 188

  
183 189
  def update
184 190
    return unless update_issue_from_params
191
    retrieve_previous_and_next_issue_ids
185 192
    @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
186 193
    saved = false
187 194
    begin
......
199 206
      flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record?
200 207

  
201 208
      respond_to do |format|
202
        format.html { redirect_back_or_default issue_path(@issue) }
209
        format.html { redirect_back_or_default issue_path(@issue) + "?next=#@next_issue_id&prev=#@prev_issue_id&pos=#@issue_position&count=#@issue_count" }
203 210
        format.api  { render_api_ok }
204 211
      end
205 212
    else
......
365 372
        end
366 373
        @prev_issue_id = issue_ids[idx - 1] if idx > 0
367 374
        @next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1)
375
      else
376
        @prev_issue_id  = @prev
377
        @next_issue_id  = @next
378
        @issue_position = @pos
379
        @issue_count    = @count
368 380
      end
369 381
    end
370 382
  end
(2-2/3)