mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
分页的部分修改
This commit is contained in:
@@ -21,11 +21,8 @@ class IssuesController < ApplicationController
|
||||
@assign_to_me_size = issues.where(assigned_to_id: current_user&.id).size
|
||||
@my_published_size = issues.where(author_id: current_user&.id).size
|
||||
scopes = Issues::ListQueryService.call(issues,params)
|
||||
|
||||
@page = params[:page]
|
||||
@limit = params[:limit] || 15
|
||||
@issues_size = scopes.size
|
||||
@issues = scopes.page(@page).per(@limit)
|
||||
@issues = paginate(scopes)
|
||||
|
||||
respond_to do |format|
|
||||
format.json
|
||||
|
||||
@@ -19,11 +19,8 @@ class PullRequestsController < ApplicationController
|
||||
@user_admin_or_member = current_user.present? && (current_user.admin || @project.member?(current_user))
|
||||
|
||||
scopes = Issues::ListQueryService.call(issues,params)
|
||||
|
||||
@page = params[:page]
|
||||
@limit = params[:limit] || 15
|
||||
@issues_size = scopes.size
|
||||
@issues = scopes.page(@page).per(@limit)
|
||||
@issues = paginate(scopes)
|
||||
end
|
||||
|
||||
def new
|
||||
|
||||
@@ -41,7 +41,7 @@ class Issues::ListQueryService < ApplicationService
|
||||
|
||||
order_type = params[:order_type] || "desc" #或者"asc"
|
||||
order_name = params[:order_name] || "created_on" #或者"updated_on"
|
||||
issues.order("#{order_name} #{order_type}")
|
||||
issues.reorder("#{order_name} #{order_type}")
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user