36580-v2.patch

Go MAEDA, 2022-02-15 07:12

Download (13 KB)

View differences:

app/views/common/_diff.html.erb
6 6
<% diff.each do |table_file| -%>
7 7
<div class="autoscroll">
8 8
<% if diff.diff_type == 'sbs' -%>
9
<table class="filecontent">
9
<table class="filecontent diffcontent">
10 10
<thead>
11 11
<tr>
12 12
  <th colspan="4" class="filename">
......
21 21
<% table_file.each_line do |spacing, line| -%>
22 22
<% if spacing -%>
23 23
<tr class="spacing">
24
  <th class="line-num">...</th><td></td><th class="line-num">...</th><td></td>
24
  <th class="line-num" data-txt="..."></th><td></td><th class="line-num" data-txt="..."></th><td></td>
25 25
</tr>
26 26
<% end -%>
27 27
<tr>
28
  <th class="line-num"><%= line.nb_line_left %></th>
28
  <th class="line-num" data-txt="<%= line.nb_line_left %>"></th>
29 29
  <td class="line-code <%= line.type_diff_left %>">
30
    <pre><%= line.html_line_left.html_safe %></pre>
30
    <div><%= line.html_line_left.html_safe %></div>
31 31
  </td>
32
  <th class="line-num"><%= line.nb_line_right %></th>
32
  <th class="line-num" data-txt="<%= line.nb_line_right %>"></th>
33 33
  <td class="line-code <%= line.type_diff_right %>">
34
    <pre><%= line.html_line_right.html_safe %></pre>
34
    <div><%= line.html_line_right.html_safe %></div>
35 35
  </td>
36 36
</tr>
37 37
<% end -%>
......
39 39
</table>
40 40

  
41 41
<% else -%>
42
<table class="filecontent">
42
<table class="filecontent diffcontent">
43 43
<thead>
44 44
  <tr>
45 45
    <th colspan="3" class="filename">
......
58 58
</tr>
59 59
<% end -%>
60 60
<tr>
61
  <th class="line-num"><%= line.nb_line_left %></th>
62
  <th class="line-num"><%= line.nb_line_right %></th>
61
  <th class="line-num" data-txt="<%= line.nb_line_left %>"></th>
62
  <th class="line-num" data-txt="<%= line.nb_line_right %>"></th>
63 63
  <td class="line-code <%= line.type_diff %>">
64
    <pre><%= line.html_line.html_safe %></pre>
64
    <div><%= line.html_line.html_safe %></div>
65 65
  </td>
66 66
</tr>
67 67
<% end -%>
app/views/common/_file.html.erb
4 4
<% line_num = 1 %>
5 5
<% syntax_highlight_lines(filename, Redmine::CodesetUtil.to_utf8_by_setting(content)).each do |line| %>
6 6
  <tr id="L<%= line_num %>">
7
    <th class="line-num">
8
      <a href="#L<%= line_num %>"><%= line_num %></a>
9
    </th>
7
    <th class="line-num"><a href="#L<%= line_num %>" data-txt="<%= line_num %>"></a></th>
10 8
    <td class="line-code">
11
      <pre><%= line.html_safe %></pre>
9
      <% if line == "\n" or line == "\r\n" %>
10
      <br>
11
      <% else %>
12
      <div><%= line.html_safe %></div>
13
      <% end %>
12 14
    </td>
13 15
  </tr>
14 16
  <% line_num += 1 %>
app/views/repositories/annotate.html.erb
17 17
    <% syntax_highlight_lines(@path, Redmine::CodesetUtil.to_utf8_by_setting(@annotate.content)).each do |line| %>
18 18
      <% revision = @annotate.revisions[line_num - 1] %>
19 19
      <tr id="L<%= line_num %>" class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %> <%= previous_revision && revision && revision != previous_revision ? 'bloc-change' : nil%>">
20
        <th class="line-num"><a href="#L<%= line_num %>"><%= line_num %></a></th>
20
        <th class="line-num"><a href="#L<%= line_num %>" data-txt="<%= line_num %>"></a></th>
21 21
        <td class="revision">
22 22
          <% if revision && revision != previous_revision %>
23 23
            <%= revision.identifier ?
......
31 31
            <%= author.split('<').first %>
32 32
          <% end %>
33 33
        </td>
34
        <td class="line-code"><pre><%= line.html_safe %></pre></td>
34
        <% if line == "\n" or line == "\r\n" %>
35
        <td class="line-code"><br></td>
36
        <% else %>
37
        <td class="line-code"><div><%= line.html_safe %></div></td>
38
        <% end %>
35 39
      </tr>
36 40
      <% line_num += 1; previous_revision = revision %>
37 41
    <% end %>
public/stylesheets/scm.css
61 61
    text-decoration: none;
62 62
    color: inherit;
63 63
}
64
table.filecontent th.line-num a:after {
65
    content:  attr(data-txt);
66
}
67
table.diffcontent th.line-num:after {
68
    content:  attr(data-txt);
69
}
64 70
table.filecontent td.line-code {padding: 0 0 0 4px;}
65
table.filecontent td.line-code pre {
71
table.filecontent td.line-code pre, table.filecontent td.line-code div {
66 72
    margin: 0px;
67 73
    white-space: pre-wrap;
68 74
    font-family:Consolas, Menlo, "Liberation Mono", Courier, monospace; font-size:12px;
test/functional/attachments_controller_test.rb
157 157
    assert_response :success
158 158
    assert_equal 'text/html', @response.media_type
159 159
    assert_select 'tr#L1' do
160
      assert_select 'th.line-num', :text => '1'
160
      assert_select 'th.line-num a[data-txt=?]', '1'
161 161
      assert_select 'td', :text => /日本語/
162 162
    end
163 163
  end
......
174 174
      assert_response :success
175 175
      assert_equal 'text/html', @response.media_type
176 176
      assert_select 'tr#L7' do
177
        assert_select 'th.line-num', :text => '7'
177
        assert_select 'th.line-num a[data-txt=?]', '7'
178 178
        assert_select 'td', :text => /Demande cr\?\?e avec succ\?s/
179 179
      end
180 180
    end
......
192 192
      assert_response :success
193 193
      assert_equal 'text/html', @response.media_type
194 194
      assert_select 'tr#L7' do
195
        assert_select 'th.line-num', :text => '7'
195
        assert_select 'th.line-num a[data-txt=?]', '7'
196 196
        assert_select 'td', :text => /Demande créée avec succès/
197 197
      end
198 198
    end
test/functional/repositories_bazaar_controller_test.rb
181 181
        )
182 182
        assert_response :success
183 183
        # Line 11 removed
184
        assert_select 'th.line-num:contains(11) ~ td.diff_out', :text => /Display more information/
184
        assert_select 'th.line-num[data-txt=11] ~ td.diff_out', :text => /Display more information/
185 185
      end
186 186
    end
187 187

  
......
196 196
      )
197 197
      assert_response :success
198 198

  
199
      assert_select "th.line-num", :text => '2' do
199
      assert_select "th.line-num" do
200
        assert_select 'a[data-txt=?]', '2'
200 201
        assert_select "+ td.revision" do
201 202
          assert_select "a", :text => '3'
202 203
          assert_select "+ td.author", :text => "jsmith@" do
......
226 227
      )
227 228
      assert_response :success
228 229

  
229
      assert_select "th.line-num", :text => '1' do
230
      assert_select "th.line-num" do
231
        assert_select "a[data-txt=?]", '1'
230 232
        assert_select "+ td.revision" do
231 233
          assert_select "a", :text => '2'
232 234
          assert_select "+ td.author", :text => "test &" do
......
262 264
        )
263 265
        assert_response :success
264 266

  
265
        assert_select "th.line-num", :text => '1' do
267
        assert_select "th.line-num" do
268
          assert_select 'a[data-txt=?]', '1'
266 269
          assert_select "+ td.revision" do
267 270
            assert_select "a", :text => '2'
268 271
            assert_select "+ td.author", :text => "test Ü" do
test/functional/repositories_git_controller_test.rb
378 378
        )
379 379
        assert_response :success
380 380
        # Line 22 removed
381
        assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/
381
        assert_select 'th.line-num[data-txt=22] ~ td.diff_out', :text => /def remove/
382 382
        assert_select 'h2', :text => /2f9c0091/
383 383
      end
384 384
    end
......
403 403
          )
404 404
          assert_response :success
405 405
          # Line 22 removed
406
          assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/
406
          assert_select 'th.line-num[data-txt=22] ~ td.diff_out', :text => /def remove/
407 407
          assert_select 'h2', :text => /2f9c0091/
408 408
        end
409 409
      end
......
589 589

  
590 590
      # Line 23, changeset 2f9c0091
591 591
      assert_select 'tr' do
592
        assert_select 'th.line-num', :text => '23'
592
        assert_select 'th.line-num a[data-txt=?]', '23'
593 593
        assert_select 'td.revision', :text => /2f9c0091/
594 594
        assert_select 'td.author', :text => 'jsmith'
595 595
        assert_select 'td', :text => /remove_watcher/
......
673 673
                :rev => r1
674 674
              }
675 675
            )
676
            assert_select "th.line-num", :text => '1' do
676
            assert_select "th.line-num" do
677
              assert_select "a[data-txt=?]", '1'
677 678
              assert_select "+ td.revision" do
678 679
                assert_select "a", :text => '57ca437c'
679 680
                assert_select "+ td.author", :text => "jsmith" do
......
698 699
            :rev => r1
699 700
          }
700 701
        )
701
        assert_select "th.line-num", :text => '1' do
702
        assert_select "th.line-num" do
703
          assert_select "a[data-txt=?]", '1'
702 704
          assert_select "+ td.revision" do
703 705
            assert_select "a", :text => '83ca5fd5'
704 706
            assert_select "+ td.author", :text => "Felix Schäfer" do
test/functional/repositories_mercurial_controller_test.rb
396 396
          assert_response :success
397 397
          if @diff_c_support
398 398
            # Line 22 removed
399
            assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/
399
            assert_select 'th.line-num[data-txt=22] ~ td.diff_out', :text => /def remove/
400 400
            assert_select 'h2', :text => /4:def6d2f1254a/
401 401
          end
402 402
        end
......
492 492

  
493 493
      # Line 22, revision 4:def6d2f1254a
494 494
      assert_select 'tr' do
495
        assert_select 'th.line-num', :text => '22'
495
        assert_select 'th.line-num a[data-txt=?]', '22'
496 496
        assert_select 'td.revision', :text => '4:def6d2f1254a'
497 497
        assert_select 'td.author', :text => 'jsmith'
498 498
        assert_select 'td', :text => /remove_watcher/
......
548 548
          }
549 549
        )
550 550
        assert_response :success
551
        assert_select "th.line-num", :text => '1' do
551
        assert_select "th.line-num" do
552
          assert_select "a[data-txt=?]", '1'
552 553
          assert_select "+ td.revision" do
553 554
            assert_select "a", :text => '20:709858aafd1b'
554 555
            assert_select "+ td.author", :text => "jsmith" do
test/functional/repositories_subversion_controller_test.rb
557 557
      assert_response :success
558 558

  
559 559
      assert_select 'tr' do
560
        assert_select 'th.line-num', :text => '1'
560
        assert_select 'th.line-num a[data-txt=?]', '1'
561 561
        assert_select 'td.revision', :text => '4'
562 562
        assert_select 'td.author', :text => 'jp'
563 563
        assert_select 'td', :text => /stdio.h/
564 564
      end
565 565
      # Same revision
566 566
      assert_select 'tr' do
567
        assert_select 'th.line-num', :text => '2'
567
        assert_select 'th.line-num a[data-txt=?]', '2'
568 568
        assert_select 'td.revision', :text => ''
569 569
        assert_select 'td.author', :text => ''
570 570
      end