summaryrefslogtreecommitdiff
path: root/app/presenters
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-17 09:08:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-17 09:08:24 +0000
commit728a207ea6a99a4bddc16dbbe82294d3fdb60fe4 (patch)
tree4bc3b6a859681de3bbeabd7bf2ec5ffd756f3a0a /app/presenters
parentea20020f71c7226d57b6449b1d9b6c6f1298223e (diff)
downloadgitlab-ce-728a207ea6a99a4bddc16dbbe82294d3fdb60fe4.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/presenters')
-rw-r--r--app/presenters/project_presenter.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb
index 45f4668112b..8c24d07675a 100644
--- a/app/presenters/project_presenter.rb
+++ b/app/presenters/project_presenter.rb
@@ -24,7 +24,8 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
commits_anchor_data,
branches_anchor_data,
tags_anchor_data,
- files_anchor_data
+ files_anchor_data,
+ releases_anchor_data
].compact.select(&:is_link)
end
@@ -153,6 +154,22 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
empty_repo? ? nil : project_tree_path(project))
end
+ def releases_anchor_data
+ return unless can?(current_user, :read_release, project)
+
+ releases_count = project.releases.count
+ return if releases_count < 1
+
+ AnchorData.new(true,
+ statistic_icon('rocket') +
+ n_('%{strong_start}%{release_count}%{strong_end} Release', '%{strong_start}%{release_count}%{strong_end} Releases', releases_count).html_safe % {
+ release_count: number_with_delimiter(releases_count),
+ strong_start: '<strong class="project-stat-value">'.html_safe,
+ strong_end: '</strong>'.html_safe
+ },
+ project_releases_path(project))
+ end
+
def commits_anchor_data
AnchorData.new(true,
statistic_icon('commit') +