From 7d615fd516c60c0c448d3a35f56641e14b463c61 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Thu, 4 Oct 2018 13:24:06 +0000 Subject: Repository entry pagination (#29395). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@17568 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/repositories_controller.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 0c6070b80..346ecf5c7 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -146,6 +146,13 @@ class RepositoriesController < ApplicationController send_opt[:disposition] = disposition(@path) send_data @repository.cat(@path, @rev), send_opt else + # set up pagination from entry to entry + parent_path = @path.split('/')[0...-1].join('/') + @entries = @repository.entries(parent_path, @rev).reject(&:is_dir?) + if index = @entries.index{|e| e.name == @entry.name} + @paginator = Redmine::Pagination::Paginator.new(@entries.size, 1, index+1) + end + if !@entry.size || @entry.size <= Setting.file_max_size_displayed.to_i.kilobyte content = @repository.cat(@path, @rev) (show_error_not_found; return) unless content -- cgit v1.2.3