diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-01-07 12:56:18 +0100 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-01-07 12:56:18 +0100 |
commit | 41b8a238ce4bd7f091d46fb9b89b7456fde17ddf (patch) | |
tree | 5f3ab03e9d8aec93cb53df744e9a9e19fc6a9d6f /app/controllers/projects | |
parent | da912c8f4ce6a8e828bc0ef4dd352fd54df0739f (diff) | |
download | gitlab-ce-41b8a238ce4bd7f091d46fb9b89b7456fde17ddf.tar.gz |
Merge branch 'master' of github.com:gitlabhq/gitlabhq
Diffstat (limited to 'app/controllers/projects')
-rw-r--r-- | app/controllers/projects/find_file_controller.rb | 26 | ||||
-rw-r--r-- | app/controllers/projects/refs_controller.rb | 2 |
2 files changed, 28 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
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb index c4e18c17077..a8f091819ca 100644 --- a/app/controllers/projects/refs_controller.rb +++ b/app/controllers/projects/refs_controller.rb @@ -20,6 +20,8 @@ class Projects::RefsController < Projects::ApplicationController namespace_project_network_path(@project.namespace, @project, @id, @options) when "graphs" namespace_project_graph_path(@project.namespace, @project, @id) + when "find_file" + namespace_project_find_file_path(@project.namespace, @project, @id) when "graphs_commits" commits_namespace_project_graph_path(@project.namespace, @project, @id) else |