diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-12-24 14:53:52 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-12-24 14:53:52 +0200 |
commit | 5953582b65e1d49c3d04d9bc97069cb323ab277c (patch) | |
tree | cac617ef3e009f21eb1791013aa61ce5afcb3c5c | |
parent | ce527b68f07c245e887a640b6f874406bae7d0ed (diff) | |
download | gitlab-ce-5953582b65e1d49c3d04d9bc97069cb323ab277c.tar.gz |
Show Assigned/Authored/All filter for dashboard issues and mr pages
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | app/controllers/dashboard_controller.rb | 22 | ||||
-rw-r--r-- | app/views/dashboard/issues.html.haml | 4 | ||||
-rw-r--r-- | app/views/dashboard/merge_requests.html.haml | 2 | ||||
-rw-r--r-- | app/views/layouts/nav/_dashboard.html.haml | 2 | ||||
-rw-r--r-- | app/views/shared/_filter.html.haml | 12 |
5 files changed, 34 insertions, 8 deletions
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index aaab4b40c4c..70dd3fff9a0 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -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) diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index 82880d5ef63..bda5b7c9147 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -1,9 +1,9 @@ %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 diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index 9c96edeefd5..74d02336bb8 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -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 diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index cae24c3170d..12fd49e609f 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -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 diff --git a/app/views/shared/_filter.html.haml b/app/views/shared/_filter.html.haml index 2f051cea48b..c1a3a9e469d 100644 --- a/app/views/shared/_filter.html.haml +++ b/app/views/shared/_filter.html.haml @@ -1,6 +1,18 @@ = 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?)} = link_to filter_path(entity, status: nil) do Open |