Skip to content
Snippets Groups Projects
Verified Commit cff17584 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Show counters in sidebar filter in same way like we did for projects page

parent a338954c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -35,4 +35,42 @@ module DashboardHelper
path << "?#{options.to_param}"
path
end
def assigned_entities_count(current_user, entity, scope = nil)
items = current_user.send("assigned_" + entity.pluralize).opened
if scope.kind_of?(Group)
items = items.of_group(scope)
elsif scope.kind_of?(Project)
items = items.of_projects(scope)
end
items.count
end
def authored_entities_count(current_user, entity, scope = nil)
items = current_user.send(entity.pluralize).opened
if scope.kind_of?(Group)
items = items.of_group(scope)
elsif scope.kind_of?(Project)
items = items.of_projects(scope)
end
items.count
end
def authorized_entities_count(current_user, entity, scope = nil)
items = entity.classify.constantize.opened
if scope.kind_of?(Group)
items = items.of_group(scope)
elsif scope.kind_of?(Project)
items = items.of_projects(scope)
else
items = items.of_projects(current_user.authorized_projects)
end
items.count
end
end
%h3.page-title
Issues
%span.pull-right #{@issues.total_count} issues
 
%p.light
List all issues from all projects you have access to.
Loading
Loading
%h3.page-title
Merge Requests
%span.pull-right #{@merge_requests.total_count} merge requests
 
 
%p.light
Loading
Loading
%h3.page-title
Issues
%span.pull-right #{@issues.total_count} issues
 
%p.light
Only issues from
Loading
Loading
%h3.page-title
Merge Requests
%span.pull-right #{@merge_requests.total_count} merge requests
 
%p.light
Only merge requests from
Loading
Loading
Loading
Loading
@@ -2,8 +2,6 @@
= nav_link(controller: :issues) do
= link_to project_issues_path(@project), class: "tab" do
Browse Issues
- if current_controller?(:issues)
%span.badge.issue_counter #{@issues.total_count}
= nav_link(controller: :milestones) do
= link_to 'Milestones', project_milestones_path(@project), class: "tab"
= nav_link(controller: :labels) do
Loading
Loading
Loading
Loading
@@ -4,6 +4,6 @@
%i.icon-list.icon-2x
.col-md-3.responsive-side
= render 'shared/project_filter', project_entities_path: project_issues_path(@project),
labels: true, redirect: 'issues'
labels: true, redirect: 'issues', entity: 'issue'
.col-md-9.issues-holder
= render "issues"
Loading
Loading
@@ -4,14 +4,13 @@
New Merge Request
%h3.page-title
Merge Requests
%span (#{@merge_requests.total_count})
%hr
.row
.fixed.sidebar-expand-button.hidden-lg.hidden-md
%i.icon-list.icon-2x
.col-md-3.responsive-side
= render 'shared/project_filter', project_entities_path: project_merge_requests_path(@project),
labels: true, redirect: 'merge_requests'
labels: true, redirect: 'merge_requests', entity: 'merge_request'
.col-md-9
.mr-filters.append-bottom-10
.dropdown.inline
Loading
Loading
Loading
Loading
@@ -6,12 +6,18 @@
%li{class: ("active" if params[:scope] == 'assigned-to-me')}
= link_to filter_path(entity, scope: 'assigned-to-me') do
Assigned to me
%span.pull-right
= assigned_entities_count(current_user, entity, @group)
%li{class: ("active" if params[:scope] == 'authored')}
= link_to filter_path(entity, scope: 'authored') do
Created by me
%span.pull-right
= authored_entities_count(current_user, entity, @group)
%li{class: ("active" if params[:scope] == 'all')}
= link_to filter_path(entity, scope: 'all') do
Everyone's
%span.pull-right
= authorized_entities_count(current_user, entity, @group)
 
%fieldset.status-filter
%legend State
Loading
Loading
Loading
Loading
@@ -6,12 +6,18 @@
%li{class: ("active" if params[:scope] == 'all')}
= link_to project_filter_path(scope: 'all') do
Everyone's
%span.pull-right
= authorized_entities_count(current_user, entity, @project)
%li{class: ("active" if params[:scope] == 'assigned-to-me')}
= link_to project_filter_path(scope: 'assigned-to-me') do
Assigned to me
%span.pull-right
= assigned_entities_count(current_user, entity, @project)
%li{class: ("active" if params[:scope] == 'created-by-me')}
= link_to project_filter_path(scope: 'created-by-me') do
Created by me
%span.pull-right
= authored_entities_count(current_user, entity, @project)
 
%fieldset
%legend State
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment