diff options
author | Stan Hu <stanhu@gmail.com> | 2015-08-20 01:02:12 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-08-20 01:27:29 -0700 |
commit | 0a5b005da170fe81afea012b56f4810125b13ead (patch) | |
tree | 82014eb7c0d9711588e1e3376b21a92b48bb6da6 /app/views/projects/blame | |
parent | 55fc58bda4a5592f2f8deaecec9526fbe4eecd6f (diff) | |
download | gitlab-ce-0a5b005da170fe81afea012b56f4810125b13ead.tar.gz |
Fix blame view line groupings
Closes #2305
Diffstat (limited to 'app/views/projects/blame')
-rw-r--r-- | app/views/projects/blame/show.html.haml | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/app/views/projects/blame/show.html.haml b/app/views/projects/blame/show.html.haml index 05d5db5d3fe..a3ff7ce2f1f 100644 --- a/app/views/projects/blame/show.html.haml +++ b/app/views/projects/blame/show.html.haml @@ -13,30 +13,32 @@ .file-content.blame.highlight %table - current_line = 1 - - @blame.each do |raw_commit, line| + - @blame.each do |blame_group| %tr %td.blame-commit .commit - - unless @prev_commit && @prev_commit.sha == raw_commit.sha - - commit = Commit.new(raw_commit, @project) - .commit-row-title - %strong - = link_to_gfm truncate(commit.title, length: 35), namespace_project_commit_path(@project.namespace, @project, commit.id), class: "cdark" - .pull-right - = link_to commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit), class: "monospace" - - .light - = commit_author_link(commit, avatar: false) - authored - #{time_ago_with_tooltip(commit.committed_date)} - - @prev_commit = raw_commit + - commit = Commit.new(blame_group[:commit], @project) + .commit-row-title + %strong + = link_to_gfm truncate(commit.title, length: 35), namespace_project_commit_path(@project.namespace, @project, commit.id), class: "cdark" + .pull-right + = link_to commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit), class: "monospace" + + .light + = commit_author_link(commit, avatar: false) + authored + #{time_ago_with_tooltip(commit.committed_date)} %td.lines.blame-numbers %pre - = current_line - - current_line += 1 + - line_count = blame_group[:lines].count + - (current_line...(current_line + line_count)).each do |i| + = i + \ + - current_line += line_count %td.lines %pre{class: 'code highlight white'} %code - :erb - <%= highlight(@blob.name, line, nowrap: true, continue: true).html_safe %> + - blame_group[:lines].each do |line| + :erb + <%= highlight(@blob.name, line, nowrap: true, continue: true).html_safe %> |