Class: Gitlab::StaticSiteEditor::Config::GeneratedConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/static_site_editor/config/generated_config.rb

Instance Method Summary collapse

Constructor Details

#initialize(repository, ref, path, return_url) ⇒ GeneratedConfig

Returns a new instance of GeneratedConfig.


7
8
9
10
11
12
# File 'lib/gitlab/static_site_editor/config/generated_config.rb', line 7

def initialize(repository, ref, path, return_url)
  @repository = repository
  @ref = ref
  @path = path
  @return_url = return_url
end

Instance Method Details

#dataObject


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gitlab/static_site_editor/config/generated_config.rb', line 14

def data
  merge_requests_illustration_path = ActionController::Base.helpers.image_path('illustrations/merge_requests.svg')
  {
    branch: ref,
    path: path,
    commit_id: commit_id,
    project_id: project.id,
    project: project.path,
    namespace: project.namespace.full_path,
    return_url: sanitize_url(return_url),
    is_supported_content: supported_content?,
    base_url: Gitlab::Routing.url_helpers.project_show_sse_path(project, full_path),
    merge_requests_illustration_path: merge_requests_illustration_path
  }
end