diff options
author | Rémy Coutable <remy@rymai.me> | 2016-09-20 19:33:34 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-09-20 19:33:34 +0300 |
commit | 52fcb2e731fff2dcc781b81c8f573aaed354a6bb (patch) | |
tree | 411c4ef72960ccb4730e66e21cc26de9be876b0b /app/helpers | |
parent | 422c90251d9dbe42d5a8c852124398d1beae9176 (diff) | |
parent | 418e95bd5f623c4cbeac8f5c2fdf2a50e8893339 (diff) |
Merge branch 'update_issues_mr_counter' into 'master'
Fix issues with wrong issues/merge request counts when filters are selected
Closes #15356 plus counter for issues and MR are now displayed for the these paths `https://gitlab.com/groups/group-name/issues` `https://gitlab.com/groups/group-name/merge_requests` `https://gitlab.com/dashboard/issues` and `https://gitlab.com/dashboard/merge_requests`
See merge request !4960
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5f3765cad0d..ed41bf04fc0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -249,7 +249,7 @@ module ApplicationHelper milestone_title: params[:milestone_title], assignee_id: params[:assignee_id], author_id: params[:author_id], - issue_search: params[:issue_search], + search: params[:search], label_name: params[:label_name] } @@ -280,23 +280,14 @@ module ApplicationHelper end end - def state_filters_text_for(entity, project) + def state_filters_text_for(state, records) titles = { opened: "Open" } - entity_title = titles[entity] || entity.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 - end - - html = content_tag :span, entity_title + state_title = titles[state] || state.to_s.humanize + count = records.public_send(state).size + html = content_tag :span, state_title if count.present? html += " " |