Skip to content

Commit

Permalink
[webui] Fix next / previous links of Bs Requests
Browse files Browse the repository at this point in the history
The links and stored session lists were still using ids, while we
recently changed to use the number attribute as (external) identifier.
  • Loading branch information
bgeuken committed May 2, 2016
1 parent 9e7f662 commit be164fd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/api/app/controllers/webui/request_controller.rb
Expand Up @@ -112,11 +112,11 @@ def show

@request_before = nil
@request_after = nil
index = session[:requests].try(:index, @id)
index = session[:request_numbers].try(:index, @number)
if index
@request_before = session[:requests][index-1] if index > 0
@request_before = session[:request_numbers][index-1] if index > 0
# will be nil for after end
@request_after = session[:requests][index+1]
@request_after = session[:request_numbers][index+1]
end

@comments = @bsreq.comments
Expand Down Expand Up @@ -243,8 +243,8 @@ def list
requests = BsRequest.list_ids(params)
elide_len = 44
elide_len = params[:elide_len].to_i if params[:elide_len]
session[:requests] = requests
requests = BsRequest.collection(ids: session[:requests])
session[:request_numbers] = requests.map { |id| BsRequest.find(id).number }
requests = BsRequest.collection(ids: requests)
render :partial => 'shared/requests', :locals => {:requests => requests, :elide_len => elide_len, :no_target => params[:no_target]}
end

Expand Down

0 comments on commit be164fd

Please sign in to comment.