diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-05-15 09:56:56 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-05-15 09:56:56 +0000 |
commit | 3b4c0ea06ffa3411c4f7cfeb6beca7c96a5e6601 (patch) | |
tree | a7a053802113edc9a5cef77cf278afbee9834cd0 | |
parent | a13e6f13c7a1dc4ee329e36b58ec0a28c17fedeb (diff) | |
parent | ded82ed4c9fde4e439a0da01138c6a3d9c1c991e (diff) | |
download | gitlab-ce-3b4c0ea06ffa3411c4f7cfeb6beca7c96a5e6601.tar.gz |
Merge branch 'use-count-badges' into 'master'
Use count badges with number_with_delimiter helper for issue, commit count
See merge request !658
-rw-r--r-- | app/helpers/application_helper.rb | 16 | ||||
-rw-r--r-- | app/views/projects/commits/_head.html.haml | 2 |
2 files changed, 13 insertions, 5 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 672be54e66f..ea9722b9bef 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -324,12 +324,20 @@ 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 = 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 diff --git a/app/views/projects/commits/_head.html.haml b/app/views/projects/commits/_head.html.haml index 66261c7336d..e3d8cd0fdd5 100644 --- a/app/views/projects/commits/_head.html.haml +++ b/app/views/projects/commits/_head.html.haml @@ -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") |