From 9b63117856ca58a7eb117c345ab81aeea2bb1299 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 10 Jun 2012 19:19:22 +0000 Subject: [PATCH] Extract code from view. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9809 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/repositories/_dir_list_content.html.erb | 2 +- lib/redmine/scm/adapters/abstract_adapter.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/views/repositories/_dir_list_content.html.erb b/app/views/repositories/_dir_list_content.html.erb index 9cca38fe5..8ad228ded 100644 --- a/app/views/repositories/_dir_list_content.html.erb +++ b/app/views/repositories/_dir_list_content.html.erb @@ -32,7 +32,7 @@ <% if @repository.report_last_commit %> <%= link_to_revision(entry.changeset, @repository) if entry.changeset %> <%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %> -<%= entry.changeset.nil? ? h(Redmine::CodesetUtil.replace_invalid_utf8(entry.lastrev.author.to_s.split('<').first)) : h(entry.changeset.author) if entry.lastrev %> +<%= entry.author %> <%=h truncate(entry.changeset.comments, :length => 50) if entry.changeset %> <% end %> diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb index 345aeba20..feda1b345 100644 --- a/lib/redmine/scm/adapters/abstract_adapter.rb +++ b/lib/redmine/scm/adapters/abstract_adapter.rb @@ -322,6 +322,14 @@ module Redmine def is_text? Redmine::MimeType.is_type?('text', name) end + + def author + if changeset + changeset.author.to_s + elsif lastrev + Redmine::CodesetUtil.replace_invalid_utf8(lastrev.author.to_s.split('<').first) + end + end end class Revisions < Array