Use count badges with number_with_delimiter helper for issue, commit count

This commit is contained in:
Dmitriy Zaporozhets
2015-05-14 18:30:23 +03:00
parent 8dde52cc09
commit 3d4d89f060
2 changed files with 14 additions and 5 deletions
+13 -4
View File
@@ -324,12 +324,21 @@ module ApplicationHelper
count =
if project.nil?
""
nil
elsif current_controller?(:issues)
" (#{project.issues.send(entity).count})"
project.issues.send(entity).count
elsif current_controller?(:merge_requests)
" (#{project.merge_requests.send(entity).count})"
project.merge_requests.send(entity).count
end
"#{entity_title}#{count}"
html = ""
html += content_tag :span, entity_title
html += " "
if count.present?
html += content_tag :span, number_with_delimiter(count), class: 'badge'
end
html.html_safe
end
end
+1 -1
View File
@@ -3,7 +3,7 @@
= link_to namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref) do
= icon("history")
Commits
%span.badge= number_with_precision(@repository.commit_count, precision: 0, delimiter: ',')
%span.badge= number_with_delimiter(@repository.commit_count)
= nav_link(controller: :compare) do
= link_to namespace_project_compare_index_path(@project.namespace, @project, from: @repository.root_ref, to: @ref || @repository.root_ref) do
= icon("exchange")