Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-15 09:09:14 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-15 09:09:14 +0300
commit2819fd258a456f0193a2e1ca9e7a54cee45b98cf (patch)
tree0b96dc430b53a943937617888cf56874069ccde0 /app/helpers/tree_helper.rb
parent5ec2d1e9474e86064d5764bc991252dd1a370895 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers/tree_helper.rb')
-rw-r--r--app/helpers/tree_helper.rb43
1 files changed, 17 insertions, 26 deletions
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
index 1510599cd11..563450159b5 100644
--- a/app/helpers/tree_helper.rb
+++ b/app/helpers/tree_helper.rb
@@ -1,6 +1,9 @@
# frozen_string_literal: true
module TreeHelper
+ include BlobHelper
+ include WebIdeButtonHelper
+
FILE_LIMIT = 1_000
# Sorts a repository's tree so that folders are before files and renders
@@ -199,38 +202,26 @@ module TreeHelper
}
end
- def web_ide_url_data(project)
- can_push_code = current_user&.can?(:push_code, project)
- fork_path = current_user&.fork_of(project)&.full_path
+ def web_ide_button_data(options = {})
+ {
+ project_path: project_to_use.full_path,
+ ref: ActionDispatch::Journey::Router::Utils.escape_path(@ref),
- if fork_path && !can_push_code
- { path: fork_path, is_fork: true }
- else
- { path: project.full_path, is_fork: false }
- end
- end
+ is_fork: fork?,
+ needs_to_fork: needs_to_fork?,
+ gitpod_enabled: !current_user.nil? && current_user.gitpod_enabled,
+ is_blob: !options[:blob].nil?,
- def vue_ide_link_data(project, ref)
- can_collaborate = can_collaborate_with_project?(project)
- can_create_mr_from_fork = can?(current_user, :fork_project, project) && can?(current_user, :create_merge_request_in, project)
- show_web_ide_button = (can_collaborate || current_user&.already_forked?(project) || can_create_mr_from_fork)
+ show_edit_button: show_edit_button?,
+ show_web_ide_button: show_web_ide_button?,
+ show_gitpod_button: show_gitpod_button?,
- {
- web_ide_url_data: web_ide_url_data(project),
- needs_to_fork: !can_collaborate && !current_user&.already_forked?(project),
- show_web_ide_button: show_web_ide_button,
- show_gitpod_button: show_web_ide_button && Gitlab::Gitpod.feature_and_settings_enabled?(project),
- gitpod_url: full_gitpod_url(project, ref),
- gitpod_enabled: current_user&.gitpod_enabled
+ web_ide_url: web_ide_url,
+ edit_url: edit_url,
+ gitpod_url: gitpod_url
}
end
- def full_gitpod_url(project, ref)
- return "" unless Gitlab::Gitpod.feature_and_settings_enabled?(project)
-
- "#{Gitlab::CurrentSettings.gitpod_url}##{project_tree_url(project, tree_join(ref, @path || ''))}"
- end
-
def directory_download_links(project, ref, archive_prefix)
Gitlab::Workhorse::ARCHIVE_FORMATS.map do |fmt|
{