Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-01-07 14:56:18 +0300
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-01-07 14:56:18 +0300
commit41b8a238ce4bd7f091d46fb9b89b7456fde17ddf (patch)
tree5f3ab03e9d8aec93cb53df744e9a9e19fc6a9d6f /app/controllers/projects/find_file_controller.rb
parentda912c8f4ce6a8e828bc0ef4dd352fd54df0739f (diff)
Merge branch 'master' of github.com:gitlabhq/gitlabhq
Diffstat (limited to 'app/controllers/projects/find_file_controller.rb')
-rw-r--r--app/controllers/projects/find_file_controller.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/controllers/projects/find_file_controller.rb b/app/controllers/projects/find_file_controller.rb
new file mode 100644
index 00000000000..54a0c447aee
--- /dev/null
+++ b/app/controllers/projects/find_file_controller.rb
@@ -0,0 +1,26 @@
+# Controller for viewing a repository's file structure
+class Projects::FindFileController < Projects::ApplicationController
+ include ExtractsPath
+ include ActionView::Helpers::SanitizeHelper
+ include TreeHelper
+
+ before_action :require_non_empty_project
+ before_action :assign_ref_vars
+ before_action :authorize_download_code!
+
+ def show
+ return render_404 unless @repository.commit(@ref)
+
+ respond_to do |format|
+ format.html
+ end
+ end
+
+ def list
+ file_paths = @repo.ls_files(@ref)
+
+ respond_to do |format|
+ format.json { render json: file_paths }
+ end
+ end
+end