diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-17 18:21:24 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-17 18:21:24 +0000 |
commit | 1cf379f370def8e843975b5b7f0610207cac369b (patch) | |
tree | babd21e5bf7fac501dd6e51a849e369bcc21edd3 /app | |
parent | dfe2b6fbe982f1e0f8deb5da52b007634fb06384 (diff) | |
download | redmine-1cf379f370def8e843975b5b7f0610207cac369b.tar.gz redmine-1cf379f370def8e843975b5b7f0610207cac369b.zip |
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
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/application_controller.rb | 1 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 54 |
2 files changed, 2 insertions, 53 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2b5e2f2c2..019048c4f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1a0c9ea5f..9bc7afafd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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'}), |