You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

annotate.html.erb 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>
  2. <div class="contextual">
  3. <%= render :partial => 'navigation' %>
  4. </div>
  5. <h2 class="breadcrumbs"><%= render :partial => 'breadcrumbs', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
  6. <%= render :partial => 'link_to_functions' %>
  7. <% if @annotate %>
  8. <% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %>
  9. <div class="autoscroll">
  10. <table class="filecontent annotate syntaxhl">
  11. <tbody>
  12. <% line_num = 1; previous_revision = nil %>
  13. <% syntax_highlight_lines(@path, Redmine::CodesetUtil.to_utf8_by_setting(@annotate.content)).each do |line| %>
  14. <% revision = @annotate.revisions[line_num - 1] %>
  15. <% previous_annot = @annotate.previous_annotations[line_num - 1] %>
  16. <tr id="L<%= line_num %>" class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %> <%= previous_revision && revision && revision != previous_revision ? 'bloc-change' : nil%>">
  17. <th class="line-num"><a href="#L<%= line_num %>" data-txt="<%= line_num %>"></a></th>
  18. <td class="revision">
  19. <% if revision && revision != previous_revision %>
  20. <%= revision.identifier ?
  21. link_to_revision(revision, @repository) : format_revision(revision) %>
  22. <% end %>
  23. </td>
  24. <td class="author">
  25. <% if revision && revision != previous_revision %>
  26. <% author = Redmine::CodesetUtil.to_utf8(revision.author.to_s,
  27. @repository.repo_log_encoding) %>
  28. <%= author.split('<').first %>
  29. <% end %>
  30. </td>
  31. <% if @has_previous %>
  32. <td class="previous">
  33. <% if previous_annot && revision && revision != previous_revision %>
  34. <%= 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' %>
  35. <% end %>
  36. </td>
  37. <% end %>
  38. <% if line == "\n" or line == "\r\n" %>
  39. <td class="line-code"><br></td>
  40. <% else %>
  41. <td class="line-code"><div><%= line.html_safe %></div></td>
  42. <% end %>
  43. </tr>
  44. <% line_num += 1; previous_revision = revision %>
  45. <% end %>
  46. </tbody>
  47. </table>
  48. </div>
  49. <% else %>
  50. <p id="errorExplanation"><%= @error_message %></p>
  51. <% end %>
  52. <% html_title(l(:button_annotate)) -%>
  53. <% content_for :header_tags do %>
  54. <%= stylesheet_link_tag 'scm' %>
  55. <% end %>