diff options
author | winniehell <git@winniehell.de> | 2016-08-24 03:22:30 +0300 |
---|---|---|
committer | winniehell <git@winniehell.de> | 2016-08-24 13:54:16 +0300 |
commit | ddbdf4e609c70dc6ed88860b5e1e65abde69ee94 (patch) | |
tree | 824e93bbf35ee95020caeb5e316758b9aa361acb | |
parent | 75d48ae35bcdb8bfc0a6f661de32718710082856 (diff) |
Restore get_id in ExtractsPath
-rw-r--r-- | app/controllers/projects_controller.rb | 9 | ||||
-rw-r--r-- | lib/extracts_path.rb | 13 |
2 files changed, 11 insertions, 11 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 2a6385c1029..fc52cd2f367 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -5,7 +5,7 @@ class ProjectsController < Projects::ApplicationController before_action :project, except: [:new, :create] before_action :repository, except: [:new, :create] before_action :assign_ref_vars, only: [:show], if: :repo_exists? - before_action :assign_tree_vars, only: [:show], if: [:repo_exists?, :project_view_files?] + before_action :tree, only: [:show], if: [:repo_exists?, :project_view_files?] # Authorize before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export, :remove_export, :generate_new_export] @@ -332,11 +332,4 @@ class ProjectsController < Projects::ApplicationController def get_id project.repository.root_ref end - - # ExtractsPath will set @id = project.path on the show route, but it has to be the - # branch name for the tree view to work correctly. - def assign_tree_vars - @id = get_id - tree - end end diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb index a293fa2752f..a4558d157c0 100644 --- a/lib/extracts_path.rb +++ b/lib/extracts_path.rb @@ -94,9 +94,7 @@ module ExtractsPath @options = params.select {|key, value| allowed_options.include?(key) && !value.blank? } @options = HashWithIndifferentAccess.new(@options) - @id = params[:id] || params[:ref] - @id += "/" + params[:path] unless params[:path].blank? - + @id = get_id @ref, @path = extract_ref(@id) @repo = @project.repository if @options[:extended_sha1].blank? @@ -118,4 +116,13 @@ module ExtractsPath def tree @tree ||= @repo.tree(@commit.id, @path) end + + private + + # overriden in subclasses, do not remove + def get_id + id = params[:id] || params[:ref] + id += "/" + params[:path] unless params[:path].blank? + id + end end |