diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-23 19:47:22 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-23 19:47:22 +0300 |
commit | 2ed7cbfba4ff3c6a4cf3e72515a0375544998de0 (patch) | |
tree | ae6d7530745c80633cd993c99f7820e1452f3e1b /app/controllers/projects/refs_controller.rb | |
parent | 95791316f4037273af7b747ce1851d5f4e46933f (diff) | |
download | gitlab-ce-2ed7cbfba4ff3c6a4cf3e72515a0375544998de0.tar.gz |
Move projects controllers/views in Projects module
Diffstat (limited to 'app/controllers/projects/refs_controller.rb')
-rw-r--r-- | app/controllers/projects/refs_controller.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb new file mode 100644 index 00000000000..e5c090e1f4d --- /dev/null +++ b/app/controllers/projects/refs_controller.rb @@ -0,0 +1,43 @@ +class Projects::RefsController < Projects::ApplicationController + include ExtractsPath + + # Authorize + before_filter :authorize_read_project! + before_filter :authorize_code_access! + before_filter :require_non_empty_project + + def switch + respond_to do |format| + format.html do + new_path = if params[:destination] == "tree" + project_tree_path(@project, (@id)) + elsif params[:destination] == "blob" + project_blob_path(@project, (@id)) + elsif params[:destination] == "graph" + project_network_path(@project, @id, @options) + else + project_commits_path(@project, @id) + end + + redirect_to new_path + end + format.js do + @ref = params[:ref] + define_tree_vars + render "tree" + end + end + end + + def logs_tree + contents = @tree.entries + @logs = contents.map do |content| + file = params[:path] ? File.join(params[:path], content.name) : content.name + last_commit = @repo.commits(@commit.id, file, 1).last + { + file_name: content.name, + commit: last_commit + } + end + end +end |