diff options
Diffstat (limited to 'app/helpers/ide_helper.rb')
-rw-r--r-- | app/helpers/ide_helper.rb | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/app/helpers/ide_helper.rb b/app/helpers/ide_helper.rb index c5be044a27b..063eef41f77 100644 --- a/app/helpers/ide_helper.rb +++ b/app/helpers/ide_helper.rb @@ -1,20 +1,26 @@ # frozen_string_literal: true module IdeHelper - def ide_data(project:, branch:, path:, merge_request:, fork_info:) - { + # Overridden in EE + def ide_data(project:, fork_info:, params:) + base_data = { '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, 'editor-font-src-url' => font_url('jetbrains-mono/JetBrainsMono.woff2'), 'editor-font-family' => 'JetBrains Mono', - 'editor-font-format' => 'woff2', - 'merge-request' => merge_request + 'editor-font-format' => 'woff2' }.merge(use_new_web_ide? ? new_ide_data(project: project) : legacy_ide_data(project: project)) + + return base_data unless project + + base_data.merge( + 'fork-info' => fork_info&.to_json, + 'branch-name' => params[:branch], + 'file-path' => params[:path], + 'merge-request' => params[:merge_request_id] + ) end def can_use_new_web_ide? @@ -76,3 +82,5 @@ module IdeHelper current_user.dismissed_callout?(feature_name: 'web_ide_ci_environments_guidance') end end + +IdeHelper.prepend_mod_with('IdeHelper') |