diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 688fd1505..8d1f11c57 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -42,10 +42,10 @@ module RepositoriesHelper end # 获取文件目录的最新动态 - def get_trees_last_changes(project_id, rev) + def get_trees_last_changes(project_id, rev, ent_name) g = Gitlab.client begin - tree_changes = g.rep_last_changes(project_id, :rev => rev) + tree_changes = g.rep_last_changes(project_id, :rev => rev, :path => ent_name) tree_changes rescue logger.error("faile to get tress activities!") diff --git a/app/views/repositories/_dir_list_content.html.erb b/app/views/repositories/_dir_list_content.html.erb index e82f10689..685a18fa8 100644 --- a/app/views/repositories/_dir_list_content.html.erb +++ b/app/views/repositories/_dir_list_content.html.erb @@ -3,11 +3,10 @@ depth = params[:depth].to_i %> <% ent_path = Redmine::CodesetUtil.replace_invalid_utf8(entry.path) %> <% ent_name = Redmine::CodesetUtil.replace_invalid_utf8(entry.name) %> -<% get_trees_last_changes(@project.id, @rev) %> +<% latest_changes = get_trees_last_changes(@project.gpid, @rev, ent_name) %> -"> +"> <% if entry.is_dir? %> <%# 展开文件目录 %> + :class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%> <%# if @repository.report_last_commit %> - 一个月前<%#= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %> - huang<%#= entry.author %> - 修改版本库<%#=h truncate(entry.changeset.comments, :length => 50) if entry.changeset %> + + <%#= format_time(latest_changes.first.last_change.split(",")[1]) %> + <%= distance_of_time_in_words(latest_changes.first.last_change.split(",")[1], Time.now) if latest_changes && latest_changes.first.last_change %> + + <%= (latest_changes.first.last_change.split(",")[2]) if latest_changes && latest_changes.first.last_change %><%#= entry.author %> + <%= (latest_changes.first.last_change.split(",")[3]) if latest_changes && latest_changes.first.last_change %><%#=h truncate(entry.changeset.comments, :length => 50) if entry.changeset %> <%# end %> <% end %>