Commit a36926216fc7d3f4d2c36b4637d21a39b8ea7cd9
1 parent
e98d4780
Exists in
master
and in
4 other branches
line numbers for blame
Showing
2 changed files
with
33 additions
and
10 deletions
Show diff stats
app/assets/stylesheets/sections/tree.scss
... | ... | @@ -80,6 +80,18 @@ |
80 | 80 | margin: 0; |
81 | 81 | padding: 0; |
82 | 82 | } |
83 | + td.blame-commit { | |
84 | + background: #f9f9f9; | |
85 | + min-width: 350px; | |
86 | + } | |
87 | + td.blame-numbers { | |
88 | + pre { | |
89 | + color: #AAA; | |
90 | + white-space: pre; | |
91 | + } | |
92 | + background: #f1f1f1; | |
93 | + border-left: 1px solid #DDD; | |
94 | + } | |
83 | 95 | } |
84 | 96 | } |
85 | 97 | ... | ... |
app/views/blame/show.html.haml
... | ... | @@ -20,16 +20,27 @@ |
20 | 20 | %span.options= render "tree/blob_actions" |
21 | 21 | .file_content.blame |
22 | 22 | %table |
23 | + - current_line = 1 | |
23 | 24 | - @blame.each do |commit, lines| |
24 | - - commit = Commit.new(commit) | |
25 | - - commit = CommitDecorator.decorate(commit) | |
25 | + - commit = CommitDecorator.decorate(Commit.new(commit)) | |
26 | 26 | %tr |
27 | - %td.author= commit.author_link avatar: true, size: 16 | |
28 | - %td.blame_commit | |
29 | - | |
30 | - %code= link_to commit.short_id, project_commit_path(@project, commit) | |
31 | - = link_to_gfm truncate(commit.title, length: 30), project_commit_path(@project, commit), class: "row_title" rescue "--broken encoding" | |
27 | + %td.blame-commit | |
28 | + %span.commit | |
29 | + = link_to commit.short_id(8), project_commit_path(@project, commit), class: "commit_short_id" | |
30 | + | |
31 | + = commit.author_link avatar: true, size: 16 | |
32 | + | |
33 | + = link_to_gfm truncate(commit.title, length: 20), project_commit_path(@project, commit.id), class: "row_title" | |
34 | + %td.lines.blame-numbers | |
35 | + %pre | |
36 | + - if lines.empty? | |
37 | + = current_line | |
38 | + - current_line += 1 | |
39 | + - else | |
40 | + - lines.each do |line| | |
41 | + = current_line | |
42 | + - current_line += 1 | |
32 | 43 | %td.lines |
33 | - = preserve do | |
34 | - %pre | |
35 | - = lines.join("\n") | |
44 | + %pre | |
45 | + - lines.each do |line| | |
46 | + = line | ... | ... |