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 ...@@ -50,16 +50,30 @@ class DashboardController < ApplicationController
@projects = @projects.page(params[:page]).per(30) @projects = @projects.page(params[:page]).per(30)
end end
# Get authored or assigned open merge requests
def 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 = FilterContext.new(@merge_requests, params).execute
@merge_requests = @merge_requests.recent.page(params[:page]).per(20) @merge_requests = @merge_requests.recent.page(params[:page]).per(20)
end end
# Get only assigned issues
def 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 = FilterContext.new(@issues, params).execute
@issues = @issues.recent.page(params[:page]).per(20) @issues = @issues.recent.page(params[:page]).per(20)
@issues = @issues.includes(:author, :project) @issues = @issues.includes(:author, :project)
......
%h3.page-title %h3.page-title
Issues assigned to me Issues
%span.pull-right #{@issues.total_count} issues %span.pull-right #{@issues.total_count} issues
%p.light %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 %hr
.row .row
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
%p.light %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 %hr
.row .row
.span3 .span3
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
= nav_link(path: 'dashboard#merge_requests') do = nav_link(path: 'dashboard#merge_requests') do
= link_to merge_requests_dashboard_path do = link_to merge_requests_dashboard_path do
Merge Requests 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 = nav_link(controller: :help) do
= link_to "Help", help_path = link_to "Help", help_path
= form_tag filter_path(entity), method: 'get' do = 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 %fieldset
%ul.nav.nav-pills.nav-stacked %ul.nav.nav-pills.nav-stacked
%li{class: ("active" if params[:status].blank?)} %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