Fix pagination for RfCs
This commit is contained in:
@ -32,9 +32,11 @@ class RequestForCommentsController < ApplicationController
|
|||||||
.includes(submission: %i[study_group exercise])
|
.includes(submission: %i[study_group exercise])
|
||||||
.includes(:file, :comments, :user)
|
.includes(:file, :comments, :user)
|
||||||
.order(created_at: :desc) # Order for the view
|
.order(created_at: :desc) # Order for the view
|
||||||
# We need to "paginate" again to enable the pagination links.
|
# We need to manually enable the pagination links.
|
||||||
# This `paginate` call is not expensive, because the total number of entries is already known.
|
.extending(WillPaginate::ActiveRecord::RelationMethods)
|
||||||
.paginate(page: params[:page], per_page: per_page_param, total_entries: @search.result.length)
|
@request_for_comments.current_page = WillPaginate::PageNumber(params[:page])
|
||||||
|
@request_for_comments.limit_value = per_page_param
|
||||||
|
@request_for_comments.total_entries = @search.result.length
|
||||||
|
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
@ -56,9 +58,11 @@ class RequestForCommentsController < ApplicationController
|
|||||||
.includes(submission: %i[study_group exercise])
|
.includes(submission: %i[study_group exercise])
|
||||||
.includes(:file, :comments, :user)
|
.includes(:file, :comments, :user)
|
||||||
.order(created_at: :desc) # Order for the view
|
.order(created_at: :desc) # Order for the view
|
||||||
# We need to "paginate" again to enable the pagination links.
|
# We need to manually enable the pagination links.
|
||||||
# This `paginate` call is not expensive, because the total number of entries is already known.
|
.extending(WillPaginate::ActiveRecord::RelationMethods)
|
||||||
.paginate(page: params[:page], per_page: per_page_param, total_entries: @search.result.length)
|
@request_for_comments.current_page = WillPaginate::PageNumber(params[:page])
|
||||||
|
@request_for_comments.limit_value = per_page_param
|
||||||
|
@request_for_comments.total_entries = @search.result.length
|
||||||
|
|
||||||
authorize!
|
authorize!
|
||||||
render 'index'
|
render 'index'
|
||||||
|
Reference in New Issue
Block a user