Commit 3b4c0ea0 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'use-count-badges' into 'master'

Use count badges with number_with_delimiter helper for issue, commit count

See merge request !658
parents a13e6f13 ded82ed4
...@@ -324,12 +324,20 @@ module ApplicationHelper ...@@ -324,12 +324,20 @@ module ApplicationHelper
count = count =
if project.nil? if project.nil?
"" nil
elsif current_controller?(:issues) elsif current_controller?(:issues)
" (#{project.issues.send(entity).count})" project.issues.send(entity).count
elsif current_controller?(:merge_requests) elsif current_controller?(:merge_requests)
" (#{project.merge_requests.send(entity).count})" project.merge_requests.send(entity).count
end end
"#{entity_title}#{count}"
html = content_tag :span, entity_title
if count.present?
html += " "
html += content_tag :span, number_with_delimiter(count), class: 'badge'
end
html.html_safe
end end
end end
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
= link_to namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref) do = link_to namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref) do
= icon("history") = icon("history")
Commits 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 = 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 = link_to namespace_project_compare_index_path(@project.namespace, @project, from: @repository.root_ref, to: @ref || @repository.root_ref) do
= icon("exchange") = icon("exchange")
......
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