summaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-12-02 20:58:02 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-12-02 20:58:02 +0000
commit8c65cc47122b802150bf3591cb4eba4f8c4fb4b4 (patch)
tree220613c121aa31f859cca016c04e7d3cc6fab320 /app/views
parente4724c7626a329cee82875a7e1bbec450eab4667 (diff)
downloadredmine-8c65cc47122b802150bf3591cb4eba4f8c4fb4b4.tar.gz
redmine-8c65cc47122b802150bf3591cb4eba4f8c4fb4b4.zip
Added Annotate/Blame view for Subversion, CVS and Mercurial repositories.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@947 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views')
-rw-r--r--app/views/repositories/annotate.rhtml26
-rw-r--r--app/views/repositories/changes.rhtml11
-rw-r--r--app/views/repositories/entry.rhtml5
3 files changed, 33 insertions, 9 deletions
diff --git a/app/views/repositories/annotate.rhtml b/app/views/repositories/annotate.rhtml
new file mode 100644
index 000000000..b8f481ae5
--- /dev/null
+++ b/app/views/repositories/annotate.rhtml
@@ -0,0 +1,26 @@
+<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
+
+<% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %>
+
+<div class="autoscroll">
+<table class="filecontent annotate CodeRay">
+ <tbody>
+ <% line_num = 1 %>
+ <% syntax_highlight(@path, to_utf8(@annotate.content)).each_line do |line| %>
+ <% revision = @annotate.revisions[line_num-1] %>
+ <tr class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %>">
+ <th class="line-num"><%= line_num %></th>
+ <td class="revision">
+ <%= (revision.identifier ? link_to(revision.identifier, :action => 'revision', :id => @project, :rev => revision.identifier) : revision.revision) if revision %></td>
+ <td class="author"><%= h(revision.author) if revision %></td>
+ <td class="line-code"><pre><%= line %></pre></td>
+ </tr>
+ <% line_num += 1 %>
+ <% end %>
+ <tbody>
+</table>
+</div>
+
+<% content_for :header_tags do %>
+<%= stylesheet_link_tag 'scm' %>
+<% end %>
diff --git a/app/views/repositories/changes.rhtml b/app/views/repositories/changes.rhtml
index 5d1db96ba..f843983db 100644
--- a/app/views/repositories/changes.rhtml
+++ b/app/views/repositories/changes.rhtml
@@ -2,14 +2,17 @@
<h3><%=h @entry.name %></h3>
-<% if @repository.supports_cat? %>
<p>
<% if @entry.is_text? %>
-<%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> |
+ <% if @repository.supports_cat? %>
+ <%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> |
+ <% end %>
+ <% if @repository.supports_annotate? %>
+ <%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => @path, :rev => @rev } %> |
+ <% end %>
<% end %>
-<%= link_to l(:button_download), {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' } %>
+<%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %>
<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
</p>
-<% end %>
<%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => @entry }%>
diff --git a/app/views/repositories/entry.rhtml b/app/views/repositories/entry.rhtml
index 94db240ab..9927601d7 100644
--- a/app/views/repositories/entry.rhtml
+++ b/app/views/repositories/entry.rhtml
@@ -2,11 +2,6 @@
<div class="autoscroll">
<table class="filecontent CodeRay">
- <thead>
- <tr>
- <th colspan="2" class="filename"><%= @path %></th>
- </tr>
- </thead>
<tbody>
<% line_num = 1 %>
<% syntax_highlight(@path, to_utf8(@content)).each_line do |line| %>