Commit ef6ce7a9 authored by Douwe Maan's avatar Douwe Maan

More backend cleanup

parent f711b2df
......@@ -227,29 +227,27 @@ class ProjectsController < Projects::ApplicationController
find_commits = true
unless find_refs.nil?
find_branches = find_refs.include? 'branches'
find_tags = find_refs.include? 'tags'
find_commits = find_refs.include? 'commits'
find_branches = find_refs.include?('branches')
find_tags = find_refs.include?('tags')
find_commits = find_refs.include?('commits')
end
options = {}
if find_branches
branches = BranchesFinder.new(@repository, params).execute.map(&:name)
options = {
s_('RefSwitcher|Branches') => branches.take(100)
}
branches = BranchesFinder.new(@repository, params).execute.take(100).map(&:name)
options[s_('RefSwitcher|Branches')] = branches
end
if @repository.tag_count.nonzero? && find_tags
tags = TagsFinder.new(@repository, params).execute.map(&:name)
if find_tags && @repository.tag_count.nonzero?
tags = TagsFinder.new(@repository, params).execute.take(100).map(&:name)
options[s_('RefSwitcher|Tags')] = tags.take(100)
options[s_('RefSwitcher|Tags')] = tags
end
# If reference is commit id - we should add it to branch/tag selectbox
ref = Addressable::URI.unescape(params[:ref])
if ref && options.flatten(2).exclude?(ref) && ref =~ /\A[0-9a-zA-Z]{6,52}\z/ && find_commits
if find_commits && ref && options.flatten(2).exclude?(ref) && ref =~ /\A[0-9a-zA-Z]{6,52}\z/
options['Commits'] = [ref]
end
......
......@@ -12,14 +12,6 @@ module TreeHelper
tree.html_safe
end
def repo_url(project)
if controller_name == 'projects'
readme_path(project) || project_tree_path(project, project.default_branch)
else
request.original_url
end
end
# Return an image icon depending on the file type and mode
#
# type - String type of the tree item; either 'folder' or 'file'
......
......@@ -8,7 +8,6 @@
= render "projects/blob/auxiliary_viewer", blob: blob
#blob-content-holder.blob-content-holder
- unless show_new_repo?
%article.file-holder
= render 'projects/blob/header', blob: blob
= render 'projects/blob/content', blob: blob
%article.file-holder
= render 'projects/blob/header', blob: blob
= render 'projects/blob/content', blob: blob
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment