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
This commit is contained in:
commit
62117f2f25
2 changed files with 17 additions and 3 deletions
|
@ -318,4 +318,18 @@ module ApplicationHelper
|
||||||
profile_key_path(key)
|
profile_key_path(key)
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
%li{class: ("active" if params[:state] == 'opened')}
|
%li{class: ("active" if params[:state] == 'opened')}
|
||||||
= link_to page_filter_path(state: 'opened') do
|
= link_to page_filter_path(state: 'opened') do
|
||||||
%i.fa.fa-exclamation-circle
|
%i.fa.fa-exclamation-circle
|
||||||
Open
|
#{state_filters_text_for(:opened, @project)}
|
||||||
%li{class: ("active" if params[:state] == 'closed')}
|
%li{class: ("active" if params[:state] == 'closed')}
|
||||||
= link_to page_filter_path(state: 'closed') do
|
= link_to page_filter_path(state: 'closed') do
|
||||||
%i.fa.fa-check-circle
|
%i.fa.fa-check-circle
|
||||||
Closed
|
#{state_filters_text_for(:closed, @project)}
|
||||||
%li{class: ("active" if params[:state] == 'all')}
|
%li{class: ("active" if params[:state] == 'all')}
|
||||||
= link_to page_filter_path(state: 'all') do
|
= link_to page_filter_path(state: 'all') do
|
||||||
%i.fa.fa-compass
|
%i.fa.fa-compass
|
||||||
All
|
#{state_filters_text_for(:all, @project)}
|
||||||
|
|
||||||
.issues-details-filters
|
.issues-details-filters
|
||||||
= form_tag page_filter_path(without: [:assignee_id, :author_id, :milestone_id, :label_name]), method: :get, class: 'filter-form' do
|
= form_tag page_filter_path(without: [:assignee_id, :author_id, :milestone_id, :label_name]), method: :get, class: 'filter-form' do
|
||||||
|
|
Loading…
Reference in a new issue