From 852b336f5ea99cdbd65049d1677d8824bb65215c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 21 Dec 2012 20:58:55 +0000 Subject: [PATCH] Adds CSS classes on pagination links. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11062 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/pagination.rb | 30 ++++++++++++++++++------------ public/stylesheets/application.css | 3 +-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/redmine/pagination.rb b/lib/redmine/pagination.rb index eb1782d6d..f8e25afe7 100644 --- a/lib/redmine/pagination.rb +++ b/lib/redmine/pagination.rb @@ -154,11 +154,11 @@ module Redmine # :per_page_links if set to false, the "Per page" links are not rendered # def pagination_links_full(*args) - pagination_links_each(*args) do |text, parameters| + pagination_links_each(*args) do |text, parameters, options| if block_given? - yield text, parameters + yield text, parameters, options else - link_to text, params.merge(parameters) + link_to text, params.merge(parameters), options end end end @@ -175,18 +175,19 @@ module Redmine html = '' if paginator.previous_page # \xc2\xab(utf-8) = « - html << yield("\xc2\xab " + l(:label_previous), page_param => paginator.previous_page) + ' ' + text = "\xc2\xab " + l(:label_previous) + html << yield(text, {page_param => paginator.previous_page}, :class => 'previous') + ' ' end previous = nil paginator.linked_pages.each do |page| if previous && previous != page - 1 - html << '... ' + html << content_tag('span', '...', :class => 'spacer') + ' ' end if page == paginator.page - html << page.to_s + html << content_tag('span', page.to_s, :class => 'current page') else - html << yield(page.to_s, page_param => page) + html << yield(page.to_s, {page_param => page}, :class => 'page') end html << ' ' previous = page @@ -194,13 +195,14 @@ module Redmine if paginator.next_page # \xc2\xbb(utf-8) = » - html << yield(l(:label_next) + " \xc2\xbb", page_param => paginator.next_page) + ' ' + text = l(:label_next) + " \xc2\xbb" + html << yield(text, {page_param => paginator.next_page}, :class => 'next') + ' ' end - html << "(#{paginator.first_item}-#{paginator.last_item}/#{paginator.item_count}) " + html << content_tag('span', "(#{paginator.first_item}-#{paginator.last_item}/#{paginator.item_count})", :class => 'items') + ' ' if per_page_links != false && links = per_page_links(paginator, &block) - html << "| #{links}" + html << content_tag('span', links.to_s, :class => 'per-page') end html.html_safe @@ -211,9 +213,13 @@ module Redmine values = per_page_options(paginator.per_page, paginator.item_count) if values.any? links = values.collect do |n| - n == paginator.per_page ? n : yield(n, :per_page => n, paginator.page_param => nil) + if n == paginator.per_page + content_tag('span', n.to_s) + else + yield(n, :per_page => n, paginator.page_param => nil) + end end - l(:label_display_per_page, links.join(', ')) + l(:label_display_per_page, links.join(', ')).html_safe end end diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 862bc2613..97d26817f 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -456,8 +456,7 @@ table.fields_permissions td.required {background:#d88;} textarea#custom_field_possible_values {width: 99%} input#content_comments {width: 99%} -.pagination {font-size: 90%} -p.pagination {margin-top:8px;} +p.pagination {margin-top:8px; font-size: 90%} /***** Tabular forms ******/ .tabular p{