diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-12 13:01:54 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-12 13:01:54 +0400 |
commit | fcb0b76c32b3512ead419a4451e9cc632270fc89 (patch) | |
tree | bc96754197fbf17a940e0e85a5f53703f6b67ef6 /app/controllers/projects/refs_controller.rb | |
parent | 9fd6c3d591fb56e50a9cdbbaac557383e3ef86a7 (diff) |
Load last commit for files per 10 items.
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/projects/refs_controller.rb')
-rw-r--r-- | app/controllers/projects/refs_controller.rb | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb index 7b8026cff9f..8834a995081 100644 --- a/app/controllers/projects/refs_controller.rb +++ b/app/controllers/projects/refs_controller.rb @@ -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, |