Load last commit for files per 10 items.

Signed-off-by: Dmytro Zaporozhets's avatarDmitriy Zaporozhets <[email protected]>
parent 9fd6c3d5
......@@ -31,9 +31,23 @@ class Projects::RefsController < Projects::ApplicationController
end
def logs_tree
contents = tree.entries
@logs = contents.map do |content|
file = params[:path] ? File.join(params[:path], content.name) : content.name
@offset = if params[:offset].present?
params[:offset].to_i
else
0
end
@limit = 10
@path = params[:path]
contents = []
contents += tree.trees
contents += tree.blobs
contents += tree.submodules
@logs = contents[@offset, @limit].to_a.map do |content|
file = @path ? File.join(@path, content.name) : content.name
last_commit = @repo.last_commit_for_path(@commit.id, file)
{
file_name: content.name,
......
......@@ -7,3 +7,13 @@
var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}");
row.find("td.tree_time_ago").html('#{escape_javascript time_ago_with_tooltip(commit.committed_date)}');
row.find("td.tree_commit").html('#{escape_javascript render("projects/tree/tree_commit_column", commit: commit)}');
- if @logs.present?
:plain
var current_url = location.href.replace(/\/?$/, '/');
var log_url = '#{project_tree_url(@project, tree_join(@ref, @path || '/'))}'.replace(/\/?$/, '/');
if(current_url == log_url) {
// Load 10 more commit log for each file in tree
// if we still on the same page
ajaxGet('#{logs_file_project_ref_path(@project, @ref, @path || '/', offset: (@offset + @limit))}');
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment