diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-03 18:07:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-03 18:07:39 +0300 |
commit | 3cda3d43aef1e92e2eedf7383122c6db9c61149f (patch) | |
tree | 1b4dd068a449d050afafa403de54a00a63e9bfc4 /app/helpers | |
parent | 83916cf0a2f9254455a08a723961db34f0840df4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/ide_helper.rb | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/app/helpers/ide_helper.rb b/app/helpers/ide_helper.rb index 02980ec422e..c5be044a27b 100644 --- a/app/helpers/ide_helper.rb +++ b/app/helpers/ide_helper.rb @@ -1,17 +1,20 @@ # frozen_string_literal: true module IdeHelper - def ide_data + def ide_data(project:, branch:, path:, merge_request:, fork_info:) { 'can-use-new-web-ide' => can_use_new_web_ide?.to_s, 'use-new-web-ide' => use_new_web_ide?.to_s, 'new-web-ide-help-page-path' => help_page_path('user/project/web_ide/index.md', anchor: 'vscode-reimplementation'), 'user-preferences-path' => profile_preferences_path, - 'branch-name' => @branch, - 'file-path' => @path, - 'fork-info' => @fork_info&.to_json, - 'merge-request' => @merge_request - }.merge(use_new_web_ide? ? new_ide_data : legacy_ide_data) + 'branch-name' => branch, + 'file-path' => path, + 'fork-info' => fork_info&.to_json, + 'editor-font-src-url' => font_url('jetbrains-mono/JetBrainsMono.woff2'), + 'editor-font-family' => 'JetBrains Mono', + 'editor-font-format' => 'woff2', + 'merge-request' => merge_request + }.merge(use_new_web_ide? ? new_ide_data(project: project) : legacy_ide_data(project: project)) end def can_use_new_web_ide? @@ -24,16 +27,16 @@ module IdeHelper private - def new_ide_data + def new_ide_data(project:) { - 'project-path' => @project&.path_with_namespace, + 'project-path' => project&.path_with_namespace, 'csp-nonce' => content_security_policy_nonce, # We will replace these placeholders in the FE 'ide-remote-path' => ide_remote_path(remote_host: ':remote_host', remote_path: ':remote_path') } end - def legacy_ide_data + def legacy_ide_data(project:) { 'empty-state-svg-path' => image_path('illustrations/multi_file_editor_empty.svg'), 'no-changes-state-svg-path' => image_path('illustrations/multi-editor_no_changes_empty.svg'), @@ -44,10 +47,10 @@ module IdeHelper 'ci-help-page-path' => help_page_path('ci/quick_start/index'), 'web-ide-help-page-path' => help_page_path('user/project/web_ide/index.md'), 'render-whitespace-in-code': current_user.render_whitespace_in_code.to_s, - 'default-branch' => @project && @project.default_branch, - 'project' => convert_to_project_entity_json(@project), - 'enable-environments-guidance' => enable_environments_guidance?.to_s, - 'preview-markdown-path' => @project && preview_markdown_path(@project), + 'default-branch' => project && project.default_branch, + 'project' => convert_to_project_entity_json(project), + 'enable-environments-guidance' => enable_environments_guidance?(project).to_s, + 'preview-markdown-path' => project && preview_markdown_path(project), 'web-terminal-svg-path' => image_path('illustrations/web-ide_promotion.svg'), 'web-terminal-help-path' => help_page_path('user/project/web_ide/index.md', anchor: 'interactive-web-terminals-for-the-web-ide'), 'web-terminal-config-help-path' => help_page_path('user/project/web_ide/index.md', anchor: 'web-ide-configuration-file'), @@ -61,8 +64,8 @@ module IdeHelper API::Entities::Project.represent(project, current_user: current_user).to_json end - def enable_environments_guidance? - experiment(:in_product_guidance_environments_webide, project: @project) do |e| + def enable_environments_guidance?(project) + experiment(:in_product_guidance_environments_webide, project: project) do |e| e.candidate { !has_dismissed_ide_environments_callout? } e.run |