Class: ReleasePresenter

Inherits:
Gitlab::View::Presenter::Delegated show all
Includes:
ActionView::Helpers::UrlHelper
Defined in:
app/presenters/release_presenter.rb

Instance Attribute Summary

Attributes included from Gitlab::View::Presenter::Base

#subject

Instance Method Summary collapse

Methods inherited from Gitlab::View::Presenter::Delegated

#initialize

Methods included from Gitlab::View::Presenter::Base

#can?, #declarative_policy_delegate, #is_a?, #present, #url_builder, #web_path, #web_url

Methods included from Gitlab::Allowable

#can?

Methods included from Gitlab::Routing

add_helpers, includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

This class inherits a constructor from Gitlab::View::Presenter::Delegated

Instance Method Details

#assets_countObject


46
47
48
49
50
51
52
# File 'app/presenters/release_presenter.rb', line 46

def assets_count
  if can_download_code?
    release.assets_count
  else
    release.assets_count(except: [:sources])
  end
end

#commit_pathObject


10
11
12
13
14
# File 'app/presenters/release_presenter.rb', line 10

def commit_path
  return unless release.commit && can_download_code?

  project_commit_path(project, release.commit.id)
end

#edit_urlObject


40
41
42
43
44
# File 'app/presenters/release_presenter.rb', line 40

def edit_url
  return unless release_edit_page_available?

  edit_project_release_url(project, release)
end

#issues_urlObject


34
35
36
37
38
# File 'app/presenters/release_presenter.rb', line 34

def issues_url
  return unless release_mr_issue_urls_available?

  project_issues_url(project, params_for_issues_and_mrs)
end

#merge_requests_urlObject


28
29
30
31
32
# File 'app/presenters/release_presenter.rb', line 28

def merge_requests_url
  return unless release_mr_issue_urls_available?

  project_merge_requests_url(project, params_for_issues_and_mrs)
end

#nameObject


54
55
56
# File 'app/presenters/release_presenter.rb', line 54

def name
  can_download_code? ? release.name : "Release-#{release.id}"
end

#self_urlObject


22
23
24
25
26
# File 'app/presenters/release_presenter.rb', line 22

def self_url
  return unless ::Feature.enabled?(:release_show_page, project, default_enabled: true)

  project_release_url(project, release)
end

#tag_pathObject


16
17
18
19
20
# File 'app/presenters/release_presenter.rb', line 16

def tag_path
  return unless can_download_code?

  project_tag_path(project, release.tag)
end