Commit c6eaabd0 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '36667-add-release-count-to-project-homepage' into 'master'

Resolve "Add release count to project homepage"

Closes #36667

See merge request gitlab-org/gitlab!21350
parents 3abd7b97 23003bdd
......@@ -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') +
......
---
title: Add release count to project homepage
merge_request: 21350
author:
type: added
......@@ -401,6 +401,11 @@ msgstr[1] ""
msgid "%{strong_start}%{human_size}%{strong_end} Files"
msgstr ""
msgid "%{strong_start}%{release_count}%{strong_end} Release"
msgid_plural "%{strong_start}%{release_count}%{strong_end} Releases"
msgstr[0] ""
msgstr[1] ""
msgid "%{strong_start}%{tag_count}%{strong_end} Tag"
msgid_plural "%{strong_start}%{tag_count}%{strong_end} Tags"
msgstr[0] ""
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment