New Feature: Git Blame for file

This commit is contained in:
Dmitriy Zaporozhets 2012-05-17 19:11:45 +03:00
parent 2e54ac17c5
commit 9cd8f7b082
9 changed files with 135 additions and 15 deletions

View file

@ -0,0 +1,10 @@
%ul.nav.nav-tabs
%li
= form_tag switch_project_refs_path(@project), :method => :get, :class => "project-refs-form", :remote => true do
= select_tag "ref", grouped_options_refs, :onchange => "$(this.form).trigger('submit');", :class => "project-refs-select"
= hidden_field_tag :destination, "tree"
= hidden_field_tag :path, params[:path]
%li{:class => "#{'active' if (controller.controller_name == "refs") }"}
= link_to tree_project_ref_path(@project, @ref) do
Code

View file

@ -1,13 +1,13 @@
:css
.view_file
.view_file_header
%i.icon-file
%span.file_name
= name
%small #{file.mode}
%span.right
= link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path]), :class => "right", :target => "_blank"
= link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref), :class => "right", :style => "margin-right:10px;"
%span.options
= link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path]), :class => "btn very_small", :target => "_blank"
= link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref), :class => "btn very_small"
= link_to "blame", blame_file_project_ref_path(@project, @ref, :path => params[:path]), :class => "btn very_small"
- if file.text?
- if name =~ /\.(md|markdown)$/i
#tree-readme-holder

View file

@ -0,0 +1,46 @@
= render "head"
#tree-holder
%ul.breadcrumb
%li
%span.arrow
= link_to tree_project_ref_path(@project, @ref, :path => nil) do
= @project.name
- @tree.breadcrumbs(6) do |link|
\/
%li= link
.clear
.view_file.blame_file
.view_file_header
%i.icon-file
%span.file_name
= @tree.name
%small blame
%span.options
= link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path]), :class => "btn very_small", :target => "_blank"
= link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref), :class => "btn very_small"
= link_to "source", tree_file_project_ref_path(@project, @ref, :path => params[:path]), :class => "btn very_small"
.view_file_content
%table
- @blame.each do |commit, lines|
- commit = Commit.new(commit)
%tr
%td.author
= image_tag gravatar_icon(commit.author_email, 16)
= commit.author_name
%td.commit
 
= link_to project_commit_path(@project, :id => commit.id) do
%code= commit.id.to_s[0..10]
%span.row_title= truncate(commit.safe_message, :length => 30) rescue "--broken encoding"
%td.lines
= preserve do
%pre
- lines.each do |line|
= line
:javascript
$(function(){
$('.project-refs-select').chosen();
});

View file

@ -1,13 +1,4 @@
%ul.nav.nav-tabs
%li
= form_tag switch_project_refs_path(@project), :method => :get, :class => "project-refs-form", :remote => true do
= select_tag "ref", grouped_options_refs, :onchange => "$(this.form).trigger('submit');", :class => "project-refs-select"
= hidden_field_tag :destination, "tree"
= hidden_field_tag :path, params[:path]
%li{:class => "#{'active' if (controller.controller_name == "refs") }"}
= link_to tree_project_ref_path(@project, @ref) do
Code
= render "head"
#tree-holder= render :partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @tree}
:javascript