summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-05-17 19:11:45 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-05-17 19:11:45 +0300
commit9cd8f7b08296d73532c66f06581ff47dab9720a3 (patch)
tree1671523db0c0c2b806c750e31217ae3ee4c35cfa /app/views
parent2e54ac17c5815814f288a1a9a1b30ba79977699c (diff)
downloadgitlab-ce-9cd8f7b08296d73532c66f06581ff47dab9720a3.tar.gz
New Feature: Git Blame for file
Diffstat (limited to 'app/views')
-rw-r--r--app/views/refs/_head.html.haml10
-rw-r--r--app/views/refs/_tree_file.html.haml8
-rw-r--r--app/views/refs/blame.html.haml46
-rw-r--r--app/views/refs/tree.html.haml11
4 files changed, 61 insertions, 14 deletions
diff --git a/app/views/refs/_head.html.haml b/app/views/refs/_head.html.haml
new file mode 100644
index 00000000000..d76a4aca026
--- /dev/null
+++ b/app/views/refs/_head.html.haml
@@ -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
+
diff --git a/app/views/refs/_tree_file.html.haml b/app/views/refs/_tree_file.html.haml
index c0a11e72113..768ff5a0446 100644
--- a/app/views/refs/_tree_file.html.haml
+++ b/app/views/refs/_tree_file.html.haml
@@ -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
diff --git a/app/views/refs/blame.html.haml b/app/views/refs/blame.html.haml
new file mode 100644
index 00000000000..7307d557a30
--- /dev/null
+++ b/app/views/refs/blame.html.haml
@@ -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
+ &nbsp;
+ = 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();
+ });
diff --git a/app/views/refs/tree.html.haml b/app/views/refs/tree.html.haml
index 165d7788fa5..7d19280b820 100644
--- a/app/views/refs/tree.html.haml
+++ b/app/views/refs/tree.html.haml
@@ -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