diff options
author | Rémy Coutable <remy@rymai.me> | 2016-09-22 16:23:01 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-09-22 16:43:43 +0300 |
commit | d4e91b22fcef64cef412eb81086ef1c90ca55f22 (patch) | |
tree | 137e11ccc16cb292b2f7fa9f1d2ad4fb14e3fcd7 /app/helpers/application_helper.rb | |
parent | dfc2fe774de3a1768afe4e2fb24f32858b430da5 (diff) |
Revert part of "Merge branch 'update_issues_mr_counter' into 'master'
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 | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ed41bf04fc0..1df430e6279 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -280,14 +280,23 @@ module ApplicationHelper end end - def state_filters_text_for(state, records) + def state_filters_text_for(entity, project) titles = { opened: "Open" } - state_title = titles[state] || state.to_s.humanize - count = records.public_send(state).size - html = content_tag :span, state_title + 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 if count.present? html += " " |