0003-Pagination-use-ul-to-do-pagination-for-better-stylin.patch

Daniel Ritz, 2015-11-17 15:35

Download (12.7 KB)

View differences:

app/helpers/groups_helper.rb
41 41
      link_to text, autocomplete_for_user_group_path(group, parameters.merge(:q => params[:q], :format => 'js')), :remote => true
42 42
    }
43 43

  
44
    s + content_tag('p', links, :class => 'pagination')
44
    s + content_tag('span', links, :class => 'pagination')
45 45
  end
46 46
end
app/helpers/members_helper.rb
33 33
      link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true
34 34
    }
35 35

  
36
    s + content_tag('p', links, :class => 'pagination')
36
    s + content_tag('span', links, :class => 'pagination')
37 37
  end
38 38
end
app/views/auth_sources/index.html.erb
28 28
  </tbody>
29 29
</table>
30 30

  
31
<p class="pagination"><%= pagination_links_full @auth_source_pages %></p>
31
<span class="pagination"><%= pagination_links_full @auth_source_pages %></span>
app/views/boards/show.html.erb
50 50
  <% end %>
51 51
  </tbody>
52 52
</table>
53
<p class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></p>
53
<span class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></span>
54 54
<% else %>
55 55
<p class="nodata"><%= l(:label_no_data) %></p>
56 56
<% end %>
app/views/issue_statuses/index.html.erb
32 32
  </tbody>
33 33
</table>
34 34

  
35
<p class="pagination"><%= pagination_links_full @issue_status_pages %></p>
35
<span class="pagination"><%= pagination_links_full @issue_status_pages %></span>
36 36

  
37 37
<% html_title(l(:label_issue_status_plural)) -%>
app/views/issues/index.html.erb
66 66
<% else %>
67 67
<%= render_query_totals(@query) %>
68 68
<%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %>
69
<p class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></p>
69
<span class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></span>
70 70
<% end %>
71 71

  
72 72
<% other_formats_links do |f| %>
app/views/messages/show.html.erb
71 71
  <%= link_to_attachments message, :author => false %>
72 72
  </div>
73 73
<% end %>
74
<p class="pagination"><%= pagination_links_full @reply_pages, @reply_count, :per_page_links => false %></p>
74
<span class="pagination"><%= pagination_links_full @reply_pages, @reply_count, :per_page_links => false %></span>
75 75
<% end %>
76 76

  
77 77
<% if !@topic.locked? && authorize_for('messages', 'reply') %>
app/views/news/index.html.erb
37 37
    </article>
38 38
<% end %>
39 39
<% end %>
40
<p class="pagination"><%= pagination_links_full @news_pages %></p>
40
<span class="pagination"><%= pagination_links_full @news_pages %></span>
41 41

  
42 42
<% other_formats_links do |f| %>
43 43
  <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %>
app/views/repositories/revisions.html.erb
17 17
                       :revisions => @changesets,
18 18
                       :entry     => nil } %>
19 19

  
20
<p class="pagination"><%= pagination_links_full @changeset_pages,@changeset_count %></p>
20
<span class="pagination"><%= pagination_links_full @changeset_pages,@changeset_count %></span>
21 21

  
22 22
<% content_for :header_tags do %>
23 23
  <%= stylesheet_link_tag "scm" %>
app/views/roles/index.html.erb
29 29
  </tbody>
30 30
</table>
31 31

  
32
<p class="pagination"><%= pagination_links_full @role_pages %></p>
32
<span class="pagination"><%= pagination_links_full @role_pages %></span>
33 33

  
34 34
<% html_title(l(:label_role_plural)) -%>
app/views/search/index.html.erb
52 52
<% end %>
53 53

  
54 54
<% if @result_pages %>
55
<p class="pagination"><%= pagination_links_full @result_pages, @result_count, :per_page_links => false %></p>
55
<span class="pagination"><%= pagination_links_full @result_pages, @result_count, :per_page_links => false %></span>
56 56
<% end %>
57 57

  
58 58
<% html_title(l(:label_search)) -%>
app/views/timelog/index.html.erb
18 18

  
19 19
<% unless @entries.empty? %>
20 20
<%= render :partial => 'list', :locals => { :entries => @entries }%>
21
<p class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></p>
21
<span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span>
22 22

  
23 23
<% other_formats_links do |f| %>
24 24
  <%= f.link_to 'Atom', :url => params.merge({:issue_id => @issue, :key => User.current.rss_key}) %>
app/views/trackers/index.html.erb
34 34
  </tbody>
35 35
</table>
36 36

  
37
<p class="pagination"><%= pagination_links_full @tracker_pages %></p>
37
<span class="pagination"><%= pagination_links_full @tracker_pages %></span>
38 38

  
39 39
<% html_title(l(:label_tracker_plural)) -%>
app/views/users/index.html.erb
53 53
  </tbody>
54 54
</table>
55 55
</div>
56
<p class="pagination"><%= pagination_links_full @user_pages, @user_count %></p>
56
<span class="pagination"><%= pagination_links_full @user_pages, @user_count %></span>
57 57

  
58 58
<% html_title(l(:label_user_plural)) -%>
lib/redmine/pagination.rb
172 172
        per_page_links = false if count.nil?
173 173
        page_param = paginator.page_param
174 174

  
175
        html = ''
175
        html = '<ul class="pages">'
176 176
        if paginator.previous_page
177 177
          # \xc2\xab(utf-8) = &#171;
178 178
          text = "\xc2\xab " + l(:label_previous)
179
          html << yield(text, {page_param => paginator.previous_page},
180
            :class => 'previous', :accesskey => accesskey(:previous)) + ' '
179
          html << content_tag('li',
180
                              yield(text, {page_param => paginator.previous_page},
181
                                    :accesskey => accesskey(:previous)),
182
                              :class => 'previous page')
181 183
        end
182 184

  
183 185
        previous = nil
184 186
        paginator.linked_pages.each do |page|
185 187
          if previous && previous != page - 1
186
            html << content_tag('span', '...', :class => 'spacer') + ' '
188
            html << content_tag('li', content_tag('span', '...'), :class => 'spacer') + ' '
187 189
          end
188 190
          if page == paginator.page
189
            html << content_tag('span', page.to_s, :class => 'current page')
191
            html << content_tag('li', content_tag('span', page.to_s), :class => 'current')
190 192
          else
191
            html << yield(page.to_s, {page_param => page}, :class => 'page')
193
            html << content_tag('li',
194
                                yield(page.to_s, {page_param => page}),
195
                                :class => 'page')
192 196
          end
193
          html << ' '
194 197
          previous = page
195 198
        end
196 199

  
197 200
        if paginator.next_page
198 201
          # \xc2\xbb(utf-8) = &#187;
199 202
          text = l(:label_next) + " \xc2\xbb"
200
          html << yield(text, {page_param => paginator.next_page},
201
            :class => 'next', :accesskey => accesskey(:next)) + ' '
203
          html << content_tag('li',
204
                              yield(text, {page_param => paginator.next_page},
205
                                    :accesskey => accesskey(:next)),
206
                              :class => 'next page')
202 207
        end
208
        html << '</ul>'
203 209

  
204 210
        html << content_tag('span', "(#{paginator.first_item}-#{paginator.last_item}/#{paginator.item_count})", :class => 'items') + ' '
205 211

  
public/stylesheets/application.css
498 498

  
499 499
input#content_comments {width: 99%}
500 500

  
501
p.pagination {margin-top:8px; font-size: 90%}
501
span.pagination {margin-top:8px; font-size: 90%}
502
.pagination ul.pages {
503
  margin: 0 5px 0 0;
504
  padding: 0;
505
  display: inline;
506
}
507
.pagination ul.pages li {
508
  display: inline-block;
509
  padding-right: 4px;
510
}
502 511

  
503 512
#search-form fieldset p {margin:0.2em 0;}
504 513

  
test/unit/helpers/groups_helper_test.rb
35 35
    group = Group.generate!
36 36

  
37 37
    result = render_principals_for_new_group_users(group, 3)
38
    assert_select_in result, 'p.pagination'
39
    assert_select_in result, 'span.current.page', :text => '1'
38
    assert_select_in result, 'span.pagination'
39
    assert_select_in result, 'span.pagination li.current span', :text => '1'
40 40
    assert_select_in result, 'a[href=?]', "/groups/#{group.id}/autocomplete_for_user.js?page=2", :text => '2'
41 41
  end
42 42
end
test/unit/helpers/members_helper_test.rb
36 36
    project = Project.generate!
37 37

  
38 38
    result = render_principals_for_new_members(project, 3)
39
    assert_select_in result, 'p.pagination'
40
    assert_select_in result, 'span.current.page', :text => '1'
39
    assert_select_in result, 'span.pagination'
40
    assert_select_in result, 'span.pagination li.current span', :text => '1'
41 41
    assert_select_in result, 'a[href=?]', "/projects/#{project.identifier}/memberships/autocomplete.js?page=2", :text => '2'
42 42
  end
43 43
end
44
-