summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-04-30 04:00:57 +0000
committerGo MAEDA <maeda@farend.jp>2023-04-30 04:00:57 +0000
commitd97beec1d4cc773dd8fb8a5245efb040235f86b1 (patch)
treeddbd3486f207256f3072dfacf3598487792cf5de /app
parent24fc9a2a8e1b3f8212db890d7f82baf2d7a4b535 (diff)
downloadredmine-d97beec1d4cc773dd8fb8a5245efb040235f86b1.tar.gz
redmine-d97beec1d4cc773dd8fb8a5245efb040235f86b1.zip
Add "View annotation prior to this change" button in the annotate view of Git (#35432).
Patch by Takenori TAKAKI. git-svn-id: https://svn.redmine.org/redmine/trunk@22217 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/repositories_controller.rb4
-rw-r--r--app/views/repositories/annotate.html.erb8
2 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index c143ed233..9ef62edd1 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -208,6 +208,10 @@ class RepositoriesController < ApplicationController
elsif @annotate.lines.sum(&:size) > Setting.file_max_size_displayed.to_i.kilobyte
@annotate = nil
@error_message = l(:error_scm_annotate_big_text_file)
+ else
+ # the SCM adapter supports "View annotation prior to this change" links
+ # and the entry has previous annotations
+ @has_previous = @annotate.previous_annotations.any?
end
@changeset = @repository.find_changeset_by_name(@rev)
end
diff --git a/app/views/repositories/annotate.html.erb b/app/views/repositories/annotate.html.erb
index de30e7c00..db91ef913 100644
--- a/app/views/repositories/annotate.html.erb
+++ b/app/views/repositories/annotate.html.erb
@@ -16,6 +16,7 @@
<% line_num = 1; previous_revision = nil %>
<% syntax_highlight_lines(@path, Redmine::CodesetUtil.to_utf8_by_setting(@annotate.content)).each do |line| %>
<% revision = @annotate.revisions[line_num - 1] %>
+ <% previous_annot = @annotate.previous_annotations[line_num - 1] %>
<tr id="L<%= line_num %>" class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %> <%= previous_revision && revision && revision != previous_revision ? 'bloc-change' : nil%>">
<th class="line-num"><a href="#L<%= line_num %>" data-txt="<%= line_num %>"></a></th>
<td class="revision">
@@ -31,6 +32,13 @@
<%= author.split('<').first %>
<% end %>
</td>
+ <% if @has_previous %>
+ <td class="previous">
+ <% if previous_annot && revision && revision != previous_revision %>
+ <%= link_to '', {:action => 'annotate', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(previous_annot.split[1] || @path), :rev => previous_annot.split[0] }, :title => l(:label_view_previous_annotation), :class => 'icon icon-history' %>
+ <% end %>
+ </td>
+ <% end %>
<% if line == "\n" or line == "\r\n" %>
<td class="line-code"><br></td>
<% else %>