diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-11-28 11:13:15 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-11-28 11:13:15 +0000 |
commit | ae045cdac99e9ed54f70128b63853d8899080cb1 (patch) | |
tree | a9113533732445dc55f3a2ec4d29e17c3d37adb4 | |
parent | 0870a3a46e75568b740ad25aa730168be08a48ad (diff) | |
download | redmine-ae045cdac99e9ed54f70128b63853d8899080cb1.tar.gz redmine-ae045cdac99e9ed54f70128b63853d8899080cb1.zip |
Use ul tags to do pagination (#21258).
Patch by Daniel Ritz.
git-svn-id: http://svn.redmine.org/redmine/trunk@14897 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/helpers/groups_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/members_helper.rb | 2 | ||||
-rw-r--r-- | app/views/auth_sources/index.html.erb | 2 | ||||
-rw-r--r-- | app/views/boards/show.html.erb | 2 | ||||
-rw-r--r-- | app/views/issue_statuses/index.html.erb | 2 | ||||
-rw-r--r-- | app/views/issues/index.html.erb | 2 | ||||
-rw-r--r-- | app/views/messages/show.html.erb | 2 | ||||
-rw-r--r-- | app/views/news/index.html.erb | 2 | ||||
-rw-r--r-- | app/views/repositories/revisions.html.erb | 2 | ||||
-rw-r--r-- | app/views/roles/index.html.erb | 2 | ||||
-rw-r--r-- | app/views/search/index.html.erb | 2 | ||||
-rw-r--r-- | app/views/timelog/index.html.erb | 2 | ||||
-rw-r--r-- | app/views/trackers/index.html.erb | 2 | ||||
-rw-r--r-- | app/views/users/index.html.erb | 2 | ||||
-rw-r--r-- | lib/redmine/pagination.rb | 24 | ||||
-rw-r--r-- | public/stylesheets/application.css | 39 | ||||
-rw-r--r-- | test/unit/helpers/groups_helper_test.rb | 4 | ||||
-rw-r--r-- | test/unit/helpers/members_helper_test.rb | 4 |
18 files changed, 71 insertions, 28 deletions
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 0214d5212..0706dcbf7 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -41,6 +41,6 @@ module GroupsHelper link_to text, autocomplete_for_user_group_path(group, parameters.merge(:q => params[:q], :format => 'js')), :remote => true } - s + content_tag('p', links, :class => 'pagination') + s + content_tag('span', links, :class => 'pagination') end end diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index cd9e5632e..57ff4d4b5 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -33,6 +33,6 @@ module MembersHelper link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true } - s + content_tag('p', links, :class => 'pagination') + s + content_tag('span', links, :class => 'pagination') end end diff --git a/app/views/auth_sources/index.html.erb b/app/views/auth_sources/index.html.erb index fcdbf7d43..ecde2bf95 100644 --- a/app/views/auth_sources/index.html.erb +++ b/app/views/auth_sources/index.html.erb @@ -28,4 +28,4 @@ </tbody> </table> -<p class="pagination"><%= pagination_links_full @auth_source_pages %></p> +<span class="pagination"><%= pagination_links_full @auth_source_pages %></span> diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 7a599eae2..a9734318a 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -50,7 +50,7 @@ <% end %> </tbody> </table> -<p class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></p> +<span class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></span> <% else %> <p class="nodata"><%= l(:label_no_data) %></p> <% end %> diff --git a/app/views/issue_statuses/index.html.erb b/app/views/issue_statuses/index.html.erb index 3da8c5b80..40a5c92ce 100644 --- a/app/views/issue_statuses/index.html.erb +++ b/app/views/issue_statuses/index.html.erb @@ -32,6 +32,6 @@ </tbody> </table> -<p class="pagination"><%= pagination_links_full @issue_status_pages %></p> +<span class="pagination"><%= pagination_links_full @issue_status_pages %></span> <% html_title(l(:label_issue_status_plural)) -%> diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index de87c5ee2..8310dc73e 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -66,7 +66,7 @@ <% else %> <%= render_query_totals(@query) %> <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> -<p class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></p> +<span class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></span> <% end %> <% other_formats_links do |f| %> diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index 533be20bb..23e6f0285 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -67,7 +67,7 @@ <%= link_to_attachments message, :author => false %> </div> <% end %> -<p class="pagination"><%= pagination_links_full @reply_pages, @reply_count, :per_page_links => false %></p> +<span class="pagination"><%= pagination_links_full @reply_pages, @reply_count, :per_page_links => false %></span> <% end %> <% if !@topic.locked? && authorize_for('messages', 'reply') %> diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb index 87eb98b4b..64614c154 100644 --- a/app/views/news/index.html.erb +++ b/app/views/news/index.html.erb @@ -37,7 +37,7 @@ </article> <% end %> <% end %> -<p class="pagination"><%= pagination_links_full @news_pages %></p> +<span class="pagination"><%= pagination_links_full @news_pages %></span> <% other_formats_links do |f| %> <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %> diff --git a/app/views/repositories/revisions.html.erb b/app/views/repositories/revisions.html.erb index a1e54582f..c0afb955a 100644 --- a/app/views/repositories/revisions.html.erb +++ b/app/views/repositories/revisions.html.erb @@ -17,7 +17,7 @@ :revisions => @changesets, :entry => nil } %> -<p class="pagination"><%= pagination_links_full @changeset_pages,@changeset_count %></p> +<span class="pagination"><%= pagination_links_full @changeset_pages,@changeset_count %></span> <% content_for :header_tags do %> <%= stylesheet_link_tag "scm" %> diff --git a/app/views/roles/index.html.erb b/app/views/roles/index.html.erb index 9545d5509..6561d1170 100644 --- a/app/views/roles/index.html.erb +++ b/app/views/roles/index.html.erb @@ -29,6 +29,6 @@ </tbody> </table> -<p class="pagination"><%= pagination_links_full @role_pages %></p> +<span class="pagination"><%= pagination_links_full @role_pages %></span> <% html_title(l(:label_role_plural)) -%> diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erb index 35d0d0bf7..6fceaeab2 100644 --- a/app/views/search/index.html.erb +++ b/app/views/search/index.html.erb @@ -52,7 +52,7 @@ <% end %> <% if @result_pages %> -<p class="pagination"><%= pagination_links_full @result_pages, @result_count, :per_page_links => false %></p> +<span class="pagination"><%= pagination_links_full @result_pages, @result_count, :per_page_links => false %></span> <% end %> <% html_title(l(:label_search)) -%> diff --git a/app/views/timelog/index.html.erb b/app/views/timelog/index.html.erb index ad1854f36..a875e53af 100644 --- a/app/views/timelog/index.html.erb +++ b/app/views/timelog/index.html.erb @@ -18,7 +18,7 @@ <% unless @entries.empty? %> <%= render :partial => 'list', :locals => { :entries => @entries }%> -<p class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></p> +<span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span> <% other_formats_links do |f| %> <%= f.link_to 'Atom', :url => params.merge({:issue_id => @issue, :key => User.current.rss_key}) %> diff --git a/app/views/trackers/index.html.erb b/app/views/trackers/index.html.erb index f76a4f5db..8ba7b7cdc 100644 --- a/app/views/trackers/index.html.erb +++ b/app/views/trackers/index.html.erb @@ -34,6 +34,6 @@ </tbody> </table> -<p class="pagination"><%= pagination_links_full @tracker_pages %></p> +<span class="pagination"><%= pagination_links_full @tracker_pages %></span> <% html_title(l(:label_tracker_plural)) -%> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 7cd6bb067..c32b46a9c 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -53,6 +53,6 @@ </tbody> </table> </div> -<p class="pagination"><%= pagination_links_full @user_pages, @user_count %></p> +<span class="pagination"><%= pagination_links_full @user_pages, @user_count %></span> <% html_title(l(:label_user_plural)) -%> diff --git a/lib/redmine/pagination.rb b/lib/redmine/pagination.rb index 943e8f5a7..83ded7b40 100644 --- a/lib/redmine/pagination.rb +++ b/lib/redmine/pagination.rb @@ -172,34 +172,40 @@ module Redmine per_page_links = false if count.nil? page_param = paginator.page_param - html = '' + html = '<ul class="pages">' if paginator.previous_page # \xc2\xab(utf-8) = « text = "\xc2\xab " + l(:label_previous) - html << yield(text, {page_param => paginator.previous_page}, - :class => 'previous', :accesskey => accesskey(:previous)) + ' ' + html << content_tag('li', + yield(text, {page_param => paginator.previous_page}, + :accesskey => accesskey(:previous)), + :class => 'previous page') end previous = nil paginator.linked_pages.each do |page| if previous && previous != page - 1 - html << content_tag('span', '...', :class => 'spacer') + ' ' + html << content_tag('li', content_tag('span', '...'), :class => 'spacer') + ' ' end if page == paginator.page - html << content_tag('span', page.to_s, :class => 'current page') + html << content_tag('li', content_tag('span', page.to_s), :class => 'current') else - html << yield(page.to_s, {page_param => page}, :class => 'page') + html << content_tag('li', + yield(page.to_s, {page_param => page}), + :class => 'page') end - html << ' ' previous = page end if paginator.next_page # \xc2\xbb(utf-8) = » text = l(:label_next) + " \xc2\xbb" - html << yield(text, {page_param => paginator.next_page}, - :class => 'next', :accesskey => accesskey(:next)) + ' ' + html << content_tag('li', + yield(text, {page_param => paginator.next_page}, + :accesskey => accesskey(:next)), + :class => 'next page') end + html << '</ul>' html << content_tag('span', "(#{paginator.first_item}-#{paginator.last_item}/#{paginator.item_count})", :class => 'items') + ' ' diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 095b892e6..b59ffcf44 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -494,7 +494,44 @@ textarea#custom_field_default_value {width: 95%; resize:vertical} input#content_comments {width: 99%} -p.pagination {margin-top:8px; font-size: 90%} +span.pagination {margin-left:3px} +.pagination ul.pages { + margin: 0 5px 0 0; + padding: 0; + display: inline; +} +.pagination ul.pages li { + display: inline-block; + padding: 0; + border: 1px solid #BBB; + margin-left: -1px; + line-height: 2em; +} +.pagination ul.pages li a, +.pagination ul.pages li span { + padding: 4px 10px; +} +.pagination ul.pages li:first-child { + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} +.pagination ul.pages li:last-child { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} +.pagination ul.pages li.current { + color: white; + background-color: #628DB6; + border-color: #628DB6; +} +.pagination ul.pages li.page:hover { + background-color: #EEE; +} +.pagination ul.pages li.page a:hover, +.pagination ul.pages li.page a:active { + color: inherit; + text-decoration: inherit; +} #search-form fieldset p {margin:0.2em 0;} diff --git a/test/unit/helpers/groups_helper_test.rb b/test/unit/helpers/groups_helper_test.rb index 19a08134e..3492a0df1 100644 --- a/test/unit/helpers/groups_helper_test.rb +++ b/test/unit/helpers/groups_helper_test.rb @@ -35,8 +35,8 @@ class GroupsHelperTest < ActionView::TestCase group = Group.generate! result = render_principals_for_new_group_users(group, 3) - assert_select_in result, 'p.pagination' - assert_select_in result, 'span.current.page', :text => '1' + assert_select_in result, 'span.pagination' + assert_select_in result, 'span.pagination li.current span', :text => '1' assert_select_in result, 'a[href=?]', "/groups/#{group.id}/autocomplete_for_user.js?page=2", :text => '2' end end diff --git a/test/unit/helpers/members_helper_test.rb b/test/unit/helpers/members_helper_test.rb index 0c20aa4e7..61089bd47 100644 --- a/test/unit/helpers/members_helper_test.rb +++ b/test/unit/helpers/members_helper_test.rb @@ -36,8 +36,8 @@ class MembersHelperTest < ActionView::TestCase project = Project.generate! result = render_principals_for_new_members(project, 3) - assert_select_in result, 'p.pagination' - assert_select_in result, 'span.current.page', :text => '1' + assert_select_in result, 'span.pagination' + assert_select_in result, 'span.pagination li.current span', :text => '1' assert_select_in result, 'a[href=?]', "/projects/#{project.identifier}/memberships/autocomplete.js?page=2", :text => '2' end end |