diff options
Diffstat (limited to 'app/helpers/snippets_helper.rb')
-rw-r--r-- | app/helpers/snippets_helper.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/helpers/snippets_helper.rb b/app/helpers/snippets_helper.rb index 1be7e240c1a..36f4fced147 100644 --- a/app/helpers/snippets_helper.rb +++ b/app/helpers/snippets_helper.rb @@ -68,4 +68,18 @@ module SnippetsHelper title: 'Download', rel: 'noopener noreferrer') end + + def snippet_file_count(snippet) + file_count = snippet.statistics&.file_count + + return unless file_count&.nonzero? + + tooltip = n_('%d file', '%d files', file_count) % file_count + + tag.span(class: 'file_count', title: tooltip, data: { toggle: 'tooltip', container: 'body' }) do + concat(sprite_icon('documents', css_class: 'gl-vertical-align-middle')) + concat(' ') + concat(file_count) + end + end end |