mirror of
https://github.com/meineerde/redmine.git
synced 2025-10-17 17:01:01 +00:00
Adds pagination to admin project list.
git-svn-id: http://svn.redmine.org/redmine/trunk@15755 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
3b7d651bbb
commit
daab32923d
@ -34,7 +34,10 @@ class AdminController < ApplicationController
|
||||
|
||||
scope = Project.status(@status).sorted
|
||||
scope = scope.like(params[:name]) if params[:name].present?
|
||||
@projects = scope.to_a
|
||||
|
||||
@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
|
||||
|
||||
render :action => "projects", :layout => false if request.xhr?
|
||||
end
|
||||
|
||||
@ -192,14 +192,14 @@ class ProjectsController < ApplicationController
|
||||
unless @project.archive
|
||||
flash[:error] = l(:error_can_not_archive_project)
|
||||
end
|
||||
redirect_to admin_projects_path(:status => params[:status])
|
||||
redirect_to_referer_or admin_projects_path(:status => params[:status])
|
||||
end
|
||||
|
||||
def unarchive
|
||||
unless @project.active?
|
||||
@project.unarchive
|
||||
end
|
||||
redirect_to admin_projects_path(:status => params[:status])
|
||||
redirect_to_referer_or admin_projects_path(:status => params[:status])
|
||||
end
|
||||
|
||||
def close
|
||||
|
||||
@ -371,8 +371,8 @@ module ApplicationHelper
|
||||
# Yields the given block for each project with its level in the tree
|
||||
#
|
||||
# Wrapper for Project#project_tree
|
||||
def project_tree(projects, &block)
|
||||
Project.project_tree(projects, &block)
|
||||
def project_tree(projects, options={}, &block)
|
||||
Project.project_tree(projects, options, &block)
|
||||
end
|
||||
|
||||
def principals_check_box_tags(name, principals)
|
||||
|
||||
@ -816,8 +816,11 @@ class Project < ActiveRecord::Base
|
||||
end
|
||||
|
||||
# Yields the given block for each project with its level in the tree
|
||||
def self.project_tree(projects, &block)
|
||||
def self.project_tree(projects, options={}, &block)
|
||||
ancestors = []
|
||||
if options[:init_level] && projects.first
|
||||
ancestors = projects.first.ancestors.to_a
|
||||
end
|
||||
projects.sort_by(&:lft).each do |project|
|
||||
while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
|
||||
ancestors.pop
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
<th></th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<% project_tree(@projects) do |project, level| %>
|
||||
<% project_tree(@projects, :init_level => true) do |project, level| %>
|
||||
<tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
|
||||
<td class="name"><span><%= link_to_project_settings(project, {}, :title => project.short_description) %></span></td>
|
||||
<td><%= checked_image project.is_public? %></td>
|
||||
@ -41,3 +41,4 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<span class="pagination"><%= pagination_links_full @project_pages, @project_count %></span>
|
||||
Loading…
x
Reference in New Issue
Block a user