Project

General

Profile

Feature #43885 » 0001-Align-issue-previous-next-link-styling-with-paginati.patch

Go MAEDA, 2026-03-17 14:29

View differences:

app/assets/stylesheets/application.css
775 775
div.issue div.subject h3 {margin-block: 0 0.1em; margin-inline: 0;}
776 776
div.issue p.author {margin-block-start: 0.5em; font-size: 93%}
777 777
div.issue span.private, div.journal span.private {font-size: 60%;}
778
div.issue .next-prev-links {color:var(--oc-gray-6);}
778
div.issue .next-prev-links {color: var(--oc-gray-6); margin-block: 1px 0;}
779
div.issue .next-prev-links .pagination ul.pages {margin-inline: 0; display: inline-flex;}
780
div.issue .next-prev-links .pagination ul.pages li {margin-block-end: 0;}
779 781
div.issue .attributes {margin-block-start: 2em;}
780 782
div.issue .attributes .attribute {padding-inline-start: 180px; clear: inline-start; min-block-size: 1.8em;}
781 783
div.issue .attributes .attribute .label {inline-size: 170px; margin-inline-start: -180px; font-weight: bold; float: inline-start; overflow: clip visible; text-overflow: ellipsis;}
app/views/issues/show.html.erb
8 8
<div class="<%= @issue.css_classes %> details">
9 9
  <% if @prev_issue_id || @next_issue_id %>
10 10
    <div class="next-prev-links contextual">
11
      <%= link_to_if @prev_issue_id,
12
                     "\xc2\xab #{l(:label_previous)}",
13
                     (@prev_issue_id ? issue_path(@prev_issue_id) : nil),
14
                     :title => "##{@prev_issue_id}",
15
                     :accesskey => accesskey(:previous) %> |
16
      <% if @issue_position && @issue_count %>
17
        <span class="position">
18
          <%= link_to_if @query_path,
19
                         l(:label_item_position, :position => @issue_position, :count => @issue_count),
20
                         @query_path %>
21
        </span> |
22
      <% end %>
23
      <%= link_to_if @next_issue_id,
24
                     "#{l(:label_next)} \xc2\xbb",
25
                     (@next_issue_id ? issue_path(@next_issue_id) : nil),
26
                     :title => "##{@next_issue_id}",
27
                     :accesskey => accesskey(:next) %>
11
      <span class="pagination">
12
        <ul class="pages">
13
          <li class="<%= @prev_issue_id ? 'previous page' : 'previous' %>">
14
            <% if @prev_issue_id %>
15
              <%= link_to "\xc2\xab #{l(:label_previous)}",
16
                          issue_path(@prev_issue_id),
17
                          :title => "##{@prev_issue_id}",
18
                          :accesskey => accesskey(:previous) %>
19
            <% else %>
20
              <%= content_tag(:span, "\xc2\xab #{l(:label_previous)}") %>
21
            <% end %>
22
          </li>
23
          <% if @issue_position && @issue_count %>
24
            <li class="page position">
25
              <%= link_to_if @query_path,
26
                             l(:label_item_position, :position => @issue_position, :count => @issue_count),
27
                             @query_path %>
28
            </li>
29
          <% end %>
30
          <li class="<%= @next_issue_id ? 'next page' : 'next' %>">
31
            <% if @next_issue_id %>
32
              <%= link_to "#{l(:label_next)} \xc2\xbb",
33
                          issue_path(@next_issue_id),
34
                          :title => "##{@next_issue_id}",
35
                          :accesskey => accesskey(:next) %>
36
            <% else %>
37
              <%= content_tag(:span, "#{l(:label_next)} \xc2\xbb") %>
38
            <% end %>
39
          </li>
40
        </ul>
41
      </span>
28 42
    </div>
29 43
  <% end %>
30 44

  
test/functional/issues_controller_test.rb
2627 2627
    assert_select 'div.next-prev-links' do
2628 2628
      assert_select 'a[href="/issues/2"]', :text => /Previous/
2629 2629
      assert_select 'a[href="/issues/5"]', :text => /Next/
2630
      assert_select 'span.position', :text => "3 of #{count}"
2630
      assert_select 'li.page.position', :text => "3 of #{count}"
2631 2631
    end
2632 2632
  end
2633 2633

  
......
2704 2704
    end
2705 2705
    assert_response :success
2706 2706
    assert_select 'div.next-prev-links' do
2707
      assert_select 'a', :text => /Previous/, :count => 0
2707
      # "Previous" button for the first issue does not have the "page" class and a link
2708
      assert_select 'span.pagination ul.pages li.previous', 1
2709
      assert_select 'span.pagination ul.pages li.previous.page', 0
2710
      assert_select 'li.previous span', :text => /Previous/
2711
      assert_select 'li.previous a', :count => 0
2712
      assert_select 'span.pagination ul.pages li.next.page', 1
2708 2713
      assert_select 'a[href="/issues/2"]', :text => /Next/
2709 2714
    end
2710 2715
  end
......
2749 2754
    assert_select 'div.next-prev-links' do
2750 2755
      assert_select 'a[href="/issues/7"]', text: /Previous/
2751 2756
      assert_select 'a[href="/issues/9"]', text: /Next/
2752
      assert_select 'span.position', text: "7 of 10"
2757
      assert_select 'li.page.position', text: "7 of 10"
2753 2758
    end
2754 2759
  end
2755 2760

  
test/integration/issues_test.rb
205 205

  
206 206
      get '/issues/5'
207 207
      assert_response :success
208
      assert_select '.next-prev-links .position', :text => '5 of 6'
208
      assert_select '.next-prev-links .pagination .page.position', :text => '5 of 6'
209 209
    end
210 210
  end
211 211

  
......
217 217

  
218 218
      get '/issues/5'
219 219
      assert_response :success
220
      assert_select '.next-prev-links .position', :text => '3 of 5'
221
      assert_select '.next-prev-links .position a[href^=?]', '/projects/ecookbook/issues?'
220
      assert_select '.next-prev-links .pagination .page.position', :text => '3 of 5'
221
      assert_select '.next-prev-links .pagination .page.position a[href^=?]', '/projects/ecookbook/issues?'
222 222
    end
223 223
  end
224 224

  
......
236 236

  
237 237
      get '/issues/5'
238 238
      assert_response :success
239
      assert_select '.next-prev-links .position', :text => '6 of 8'
239
      assert_select '.next-prev-links .pagination .page.position', :text => '6 of 8'
240 240
    end
241 241
  end
242 242

  
(5-5/6)