2018-12-03 17:59:11 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module IdeHelper
|
|
|
|
def ide_data
|
|
|
|
{
|
2021-03-05 15:09:12 +00:00
|
|
|
'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'),
|
|
|
|
'committed-state-svg-path' => image_path('illustrations/multi-editor_all_changes_committed_empty.svg'),
|
|
|
|
'pipelines-empty-state-svg-path': image_path('illustrations/pipelines_empty.svg'),
|
|
|
|
'promotion-svg-path': image_path('illustrations/web-ide_promotion.svg'),
|
|
|
|
'ci-help-page-path' => help_page_path('ci/quick_start/README'),
|
|
|
|
'web-ide-help-page-path' => help_page_path('user/project/web_ide/index.md'),
|
|
|
|
'clientside-preview-enabled': Gitlab::CurrentSettings.web_ide_clientside_preview_enabled?.to_s,
|
|
|
|
'render-whitespace-in-code': current_user.render_whitespace_in_code.to_s,
|
|
|
|
'codesandbox-bundler-url': Gitlab::CurrentSettings.web_ide_clientside_preview_bundler_url,
|
|
|
|
'branch-name' => @branch,
|
|
|
|
'file-path' => @path,
|
|
|
|
'merge-request' => @merge_request,
|
2021-03-23 00:09:09 +00:00
|
|
|
'fork-info' => @fork_info&.to_json,
|
2021-03-05 15:09:12 +00:00
|
|
|
'project' => convert_to_project_entity_json(@project)
|
2018-12-03 17:59:11 +00:00
|
|
|
}
|
|
|
|
end
|
2021-03-05 15:09:12 +00:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def convert_to_project_entity_json(project)
|
|
|
|
return unless project
|
|
|
|
|
|
|
|
API::Entities::Project.represent(project).to_json
|
|
|
|
end
|
2018-12-03 17:59:11 +00:00
|
|
|
end
|
2020-07-08 00:09:06 +00:00
|
|
|
|
|
|
|
::IdeHelper.prepend_if_ee('::EE::IdeHelper')
|