diff options
author | Rémy Coutable <remy@rymai.me> | 2016-09-23 15:16:11 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-09-30 12:02:54 +0200 |
commit | 9b361a3f44eec7a301565318ce86742f2f139a9d (patch) | |
tree | dd207e7aeaecb21ffa383e972985e1b9a7834cc6 /app/helpers/application_helper.rb | |
parent | f9887a10d43fc3b382d1ef270431823d1d4491a6 (diff) | |
download | gitlab-ce-9b361a3f44eec7a301565318ce86742f2f139a9d.tar.gz |
Take filters in account in issuable counters
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1df430e6279..bbc037288db 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -280,27 +280,24 @@ module ApplicationHelper end end - def state_filters_text_for(entity, project) + def issuables_state_counter_text(state, issuables) titles = { opened: "Open" } - entity_title = titles[entity] || entity.to_s.humanize + state_title = titles[state] || state.to_s.humanize count = - if project.nil? - nil - elsif current_controller?(:issues) - project.issues.visible_to_user(current_user).send(entity).count - elsif current_controller?(:merge_requests) - project.merge_requests.send(entity).count + if @issues || @merge_requests + issuables_finder = @issues ? issues_finder : merge_requests_finder + issuables_finder.params[:state] = state + issuables_finder.execute.page(1).total_count end - html = content_tag :span, entity_title + html = content_tag(:span, state_title) if count.present? - html += " " - html += content_tag :span, number_with_delimiter(count), class: 'badge' + html << " " << content_tag(:span, number_with_delimiter(count), class: 'badge') end html.html_safe |