summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2015-04-24 14:08:40 +0000
committerMarin Jankovski <marin@gitlab.com>2015-04-24 14:08:40 +0000
commit62117f2f25646009fb5b20d7a215d7d697ce3231 (patch)
tree1358c12475705d0eab4efff4e717407d7f58ff27
parent2a3b724cf8405b623c292252a98df2b44c7a21aa (diff)
parent219cbf3927c9b6f42a47364a0d268b3ed3e82f4d (diff)
downloadgitlab-ce-62117f2f25646009fb5b20d7a215d7d697ce3231.tar.gz
Merge branch 'add_count_to_state_filters' into 'master'
Add issue and merge request count for state filters. Related to issue #2170 Changes relate to project issues and merge request pages, dashboard and group pages remain the same. See merge request !1747
-rw-r--r--app/helpers/application_helper.rb14
-rw-r--r--app/views/shared/_issuable_filter.html.haml6
2 files changed, 17 insertions, 3 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index a6844b2a47b..6e86400a4f6 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -318,4 +318,18 @@ module ApplicationHelper
profile_key_path(key)
end
end
+
+ def state_filters_text_for(entity, project)
+ entity_title = entity.to_s.humanize
+
+ count =
+ if project.nil?
+ ""
+ elsif 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