From a36926216fc7d3f4d2c36b4637d21a39b8ea7cd9 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 14 Jan 2013 20:55:57 +0200 Subject: [PATCH] line numbers for blame --- app/assets/stylesheets/sections/tree.scss | 12 +++++++++ app/views/blame/show.html.haml | 31 +++++++++++++++-------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/sections/tree.scss b/app/assets/stylesheets/sections/tree.scss index b0d795f4d5a..0ba68e5010c 100644 --- a/app/assets/stylesheets/sections/tree.scss +++ b/app/assets/stylesheets/sections/tree.scss @@ -80,6 +80,18 @@ margin: 0; padding: 0; } + td.blame-commit { + background: #f9f9f9; + min-width: 350px; + } + td.blame-numbers { + pre { + color: #AAA; + white-space: pre; + } + background: #f1f1f1; + border-left: 1px solid #DDD; + } } } diff --git a/app/views/blame/show.html.haml b/app/views/blame/show.html.haml index c5192c53cc3..36d81e6af38 100644 --- a/app/views/blame/show.html.haml +++ b/app/views/blame/show.html.haml @@ -20,16 +20,27 @@ %span.options= render "tree/blob_actions" .file_content.blame %table + - current_line = 1 - @blame.each do |commit, lines| - - commit = Commit.new(commit) - - commit = CommitDecorator.decorate(commit) + - commit = CommitDecorator.decorate(Commit.new(commit)) %tr - %td.author= commit.author_link avatar: true, size: 16 - %td.blame_commit -   - %code= link_to commit.short_id, project_commit_path(@project, commit) - = link_to_gfm truncate(commit.title, length: 30), project_commit_path(@project, commit), class: "row_title" rescue "--broken encoding" + %td.blame-commit + %span.commit + = link_to commit.short_id(8), project_commit_path(@project, commit), class: "commit_short_id" +   + = commit.author_link avatar: true, size: 16 +   + = link_to_gfm truncate(commit.title, length: 20), project_commit_path(@project, commit.id), class: "row_title" + %td.lines.blame-numbers + %pre + - if lines.empty? + = current_line + - current_line += 1 + - else + - lines.each do |line| + = current_line + - current_line += 1 %td.lines - = preserve do - %pre - = lines.join("\n") + %pre + - lines.each do |line| + = line