Commit 5953582b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Show Assigned/Authored/All filter for dashboard issues and mr pages

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent ce527b68
......@@ -50,16 +50,30 @@ class DashboardController < ApplicationController
@projects = @projects.page(params[:page]).per(30)
end
# Get authored or assigned open merge requests
def merge_requests
@merge_requests = current_user.cared_merge_requests
@merge_requests = case params[:scope]
when 'authored' then
current_user.merge_requests
when 'all' then
MergeRequest.where(target_project_id: current_user.authorized_projects.pluck(:id))
else
current_user.assigned_merge_requests
end
@merge_requests = FilterContext.new(@merge_requests, params).execute
@merge_requests = @merge_requests.recent.page(params[:page]).per(20)
end
# Get only assigned issues
def issues
@issues = current_user.assigned_issues
@issues = case params[:scope]
when 'authored' then
current_user.issues
when 'all' then
Issue.where(project_id: current_user.authorized_projects.pluck(:id))
else
current_user.assigned_issues
end
@issues = FilterContext.new(@issues, params).execute
@issues = @issues.recent.page(params[:page]).per(20)
@issues = @issues.includes(:author, :project)
......
%h3.page-title
Issues assigned to me
Issues
%span.pull-right #{@issues.total_count} issues
%p.light
For all issues you should visit the project's issues page, or use the search panel to find a specific issue.
List all issues from all project's you have access to.
%hr
.row
......
......@@ -4,7 +4,7 @@
%p.light
Only merge requests created by you or assigned to you are listed here.
List all merge requests from all project's you have access to.
%hr
.row
.span3
......
......@@ -12,7 +12,7 @@
= nav_link(path: 'dashboard#merge_requests') do
= link_to merge_requests_dashboard_path do
Merge Requests
%span.count= current_user.cared_merge_requests.opened.count
%span.count= current_user.assigned_merge_requests.opened.count
= nav_link(controller: :help) do
= link_to "Help", help_path
= form_tag filter_path(entity), method: 'get' do
%fieldset
%ul.nav.nav-pills.nav-stacked
%li{class: ("active" if params[:scope].blank?)}
= link_to filter_path(entity, scope: nil) do
Assigned to me
%li{class: ("active" if params[:scope] == 'authored')}
= link_to filter_path(entity, scope: 'authored') do
Authored by me
%li{class: ("active" if params[:scope] == 'all')}
= link_to filter_path(entity, scope: 'all') do
All
%fieldset
%ul.nav.nav-pills.nav-stacked
%li{class: ("active" if params[:status].blank?)}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment