Reuse ProjectQuery filters on the admin project list (#33422).

Patch by Takenori TAKAKI.


git-svn-id: https://svn.redmine.org/redmine/trunk@21519 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2022-04-01 15:08:52 +00:00
parent 44344cfe8a
commit 83ed32e8d7
11 changed files with 211 additions and 58 deletions

View File

@@ -26,19 +26,23 @@ class AdminController < ApplicationController
before_action :require_admin
helper :queries
include QueriesHelper
helper :projects_queries
helper :projects
def index
@no_configuration_data = Redmine::DefaultData::Loader::no_data?
end
def projects
@status = params[:status] || 1
retrieve_query(ProjectQuery, false, :defaults => @default_columns_names)
@query.admin_projects = 1
scope = @query.results_scope
scope = Project.status(@status).sorted
scope = scope.like(params[:name]) if params[:name].present?
@project_count = scope.count
@project_pages = Paginator.new @project_count, per_page_option, params['page']
@projects = scope.limit(@project_pages.per_page).offset(@project_pages.offset).to_a
@entry_count = scope.count
@entry_pages = Paginator.new @entry_count, per_page_option, params['page']
@projects = scope.limit(@entry_pages.per_page).offset(@entry_pages.offset).to_a
render :action => "projects", :layout => false if request.xhr?
end