Merge branch 'develop' into standalone_develop

This commit is contained in:
yystopf 2023-03-24 14:34:51 +08:00
commit 22929e54d3
2 changed files with 9 additions and 1 deletions

View File

@ -680,6 +680,14 @@ class ApplicationController < ActionController::Base
relation.page(page).per(limit)
end
def kaminari_unlimit_paginate(ralation)
limit = params[:limit] || params[:per_page]
limit = (limit.to_i.zero? || limit.to_i > 9999) ? 9999 : limit.to_i
page = params[:page].to_i.zero? ? 1 : params[:page].to_i
relation.page(page).per(limit)
end
def kaminari_array_paginate(relation)
limit = params[:limit] || params[:per_page]
limit = (limit.to_i.zero? || limit.to_i > 20) ? 20 : limit.to_i

View File

@ -406,7 +406,7 @@ class UsersController < ApplicationController
is_current_admin_user = User.current.logged? && (current_user&.admin? || current_user.id == @user.id)
scope = Projects::ListMyQuery.call(params, @user,is_current_admin_user)
@total_count = scope.size
@projects = paginate(scope)
@projects = kaminari_unlimit_paginate(scope)
end