Replaces the classic_pagination plugin with a simple pagination module.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11026 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
dfe2b6fbe9
commit
1cf379f370
26 files changed
+317
-1327
No files matched your search
@@ -22,6 +22,7 @@ class Unauthorized < Exception; end
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
include Redmine::I18n
|
||||
include Redmine::Pagination
|
||||
|
||||
class_attribute :accept_api_auth_actions
|
||||
class_attribute :accept_rss_auth_actions
|
||||
|
||||
@@ -24,6 +24,7 @@ module ApplicationHelper
|
||||
include Redmine::WikiFormatting::Macros::Definitions
|
||||
include Redmine::I18n
|
||||
include GravatarHelper::PublicMethods
|
||||
include Redmine::Pagination::Helper
|
||||
|
||||
extend Forwardable
|
||||
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
|
||||
@@ -391,59 +392,6 @@ module ApplicationHelper
|
||||
str.blank? ? nil : str
|
||||
end
|
||||
|
||||
def pagination_links_full(paginator, count=nil, options={})
|
||||
page_param = options.delete(:page_param) || :page
|
||||
per_page_links = options.delete(:per_page_links)
|
||||
url_param = params.dup
|
||||
|
||||
html = ''
|
||||
if paginator.current.previous
|
||||
# \xc2\xab(utf-8) = «
|
||||
html << link_to_content_update(
|
||||
"\xc2\xab " + l(:label_previous),
|
||||
url_param.merge(page_param => paginator.current.previous)) + ' '
|
||||
end
|
||||
|
||||
html << (pagination_links_each(paginator, options) do |n|
|
||||
link_to_content_update(n.to_s, url_param.merge(page_param => n))
|
||||
end || '')
|
||||
|
||||
if paginator.current.next
|
||||
# \xc2\xbb(utf-8) = »
|
||||
html << ' ' + link_to_content_update(
|
||||
(l(:label_next) + " \xc2\xbb"),
|
||||
url_param.merge(page_param => paginator.current.next))
|
||||
end
|
||||
|
||||
unless count.nil?
|
||||
html << " (#{paginator.current.first_item}-#{paginator.current.last_item}/#{count})"
|
||||
if per_page_links != false && links = per_page_links(paginator.items_per_page, count)
|
||||
html << " | #{links}"
|
||||
end
|
||||
end
|
||||
|
||||
html.html_safe
|
||||
end
|
||||
|
||||
def per_page_links(selected=nil, item_count=nil)
|
||||
values = Setting.per_page_options_array
|
||||
if item_count && values.any?
|
||||
if item_count > values.first
|
||||
max = values.detect {|value| value >= item_count} || item_count
|
||||
else
|
||||
max = item_count
|
||||
end
|
||||
values = values.select {|value| value <= max || value == selected}
|
||||
end
|
||||
if values.empty? || (values.size == 1 && values.first == selected)
|
||||
return nil
|
||||
end
|
||||
links = values.collect do |n|
|
||||
n == selected ? n : link_to_content_update(n, params.merge(:per_page => n))
|
||||
end
|
||||
l(:label_display_per_page, links.join(', '))
|
||||
end
|
||||
|
||||
def reorder_links(name, url, method = :post)
|
||||
link_to(image_tag('2uparrow.png', :alt => l(:label_sort_highest)),
|
||||
url.merge({"#{name}[move_to]" => 'highest'}),
|
||||
|
||||
Reference in new issue
Block a user