diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2015-03-31 17:53:04 -0700 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2015-04-24 13:53:21 +0200 |
commit | 69778103608633cab1329c90a6cbdbc6c9b64bd7 (patch) | |
tree | 93d2ff171675e81dc19f19861a38da8859645d64 | |
parent | b0ed2ff1a69df384a1cb9a184c0528bec1986827 (diff) | |
download | gitlab-ce-69778103608633cab1329c90a6cbdbc6c9b64bd7.tar.gz |
Add issue and merge request count for state filters.
-rw-r--r-- | app/helpers/application_helper.rb | 12 | ||||
-rw-r--r-- | app/views/shared/_issuable_filter.html.haml | 6 |
2 files changed, 15 insertions, 3 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a6844b2a47b..25acf3ca1b5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -318,4 +318,16 @@ module ApplicationHelper profile_key_path(key) end end + + def state_filters_text_for(entity, project) + entity_title = entity.to_s.humanize + + count = + if current_controller?(:issues) + " (#{project.issues.send(entity).count})" + elsif current_controller?(:merge_requests) + " (#{project.merge_requests.send(entity).count})" + end + "#{entity_title}#{count}" + end end diff --git a/app/views/shared/_issuable_filter.html.haml b/app/views/shared/_issuable_filter.html.haml index 83f5a3a8015..f9eb2dcfa28 100644 --- a/app/views/shared/_issuable_filter.html.haml +++ b/app/views/shared/_issuable_filter.html.haml @@ -4,15 +4,15 @@ %li{class: ("active" if params[:state] == 'opened')} = link_to page_filter_path(state: 'opened') do %i.fa.fa-exclamation-circle - Open + #{state_filters_text_for(:opened, @project)} %li{class: ("active" if params[:state] == 'closed')} = link_to page_filter_path(state: 'closed') do %i.fa.fa-check-circle - Closed + #{state_filters_text_for(:closed, @project)} %li{class: ("active" if params[:state] == 'all')} = link_to page_filter_path(state: 'all') do %i.fa.fa-compass - All + #{state_filters_text_for(:all, @project)} .issues-details-filters = form_tag page_filter_path(without: [:assignee_id, :author_id, :milestone_id, :label_name]), method: :get, class: 'filter-form' do |