[#369] dont redirect to project if get an ajax request
This commit is contained in:
parent
f6257a97f6
commit
9f53a384db
|
@ -1,6 +1,6 @@
|
||||||
class Projects::Git::TreesController < Projects::Git::BaseController
|
class Projects::Git::TreesController < Projects::Git::BaseController
|
||||||
|
|
||||||
before_filter -> {redirect_to @project if params[:treeish] == @project.resolve_default_branch and params[:path].blank?}, only: :show
|
before_filter -> { redirect_to_project }, only: :show
|
||||||
skip_before_filter :set_branch_and_tree, :set_treeish_and_path, only: :archive
|
skip_before_filter :set_branch_and_tree, :set_treeish_and_path, only: :archive
|
||||||
before_filter -> { raise Grit::NoSuchPathError if params[:treeish] != @branch.try(:name) }, only: [:branch, :destroy]
|
before_filter -> { raise Grit::NoSuchPathError if params[:treeish] != @branch.try(:name) }, only: [:branch, :destroy]
|
||||||
|
|
||||||
|
@ -79,4 +79,12 @@ class Projects::Git::TreesController < Projects::Git::BaseController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def redirect_to_project
|
||||||
|
if params[:treeish] == @project.resolve_default_branch && params[:path].blank? && !request.xhr?
|
||||||
|
redirect_to @project
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,6 +10,7 @@ if params[:info] == 'true'
|
||||||
else
|
else
|
||||||
|
|
||||||
page = params[:page].to_i
|
page = params[:page].to_i
|
||||||
|
page = page < 1 ? 0 : page
|
||||||
|
|
||||||
json.tree do
|
json.tree do
|
||||||
json.array! @project.tree_info(@tree, @treeish, @path, page).each do |node, node_path, commit|
|
json.array! @project.tree_info(@tree, @treeish, @path, page).each do |node, node_path, commit|
|
||||||
|
|
Loading…
Reference in New Issue