summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-04-15 21:35:48 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2016-04-18 17:32:47 -0500
commitded5efad1ffddb5f1bf8585802bb25e588eee6ea (patch)
tree4316fe025a5deb0197df77a3dff40500c5651e26 /app
parent17b60d681828567e47c8a62ef312abc46e2beeea (diff)
downloadgitlab-ce-ded5efad1ffddb5f1bf8585802bb25e588eee6ea.tar.gz
Allow filtering by Owned projects
Diffstat (limited to 'app')
-rw-r--r--app/controllers/concerns/filter_projects.rb5
-rw-r--r--app/views/shared/projects/_dropdown.html.haml10
2 files changed, 14 insertions, 1 deletions
diff --git a/app/controllers/concerns/filter_projects.rb b/app/controllers/concerns/filter_projects.rb
index f63b703d101..091412a7c93 100644
--- a/app/controllers/concerns/filter_projects.rb
+++ b/app/controllers/concerns/filter_projects.rb
@@ -10,6 +10,11 @@ module FilterProjects
def filter_projects(projects)
projects = projects.search(params[:filter_projects]) if params[:filter_projects].present?
projects = projects.non_archived if params[:archived].blank?
+
+ if params[:personal].present? and current_user
+ projects = projects.personal(current_user)
+ end
+
projects
end
end
diff --git a/app/views/shared/projects/_dropdown.html.haml b/app/views/shared/projects/_dropdown.html.haml
index e7e04621ff4..681d182daee 100644
--- a/app/views/shared/projects/_dropdown.html.haml
+++ b/app/views/shared/projects/_dropdown.html.haml
@@ -1,4 +1,5 @@
- @sort ||= sort_value_recently_updated
+- personal = params[:personal]
- archived = params[:archived]
.dropdown.inline
%button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'}
@@ -10,7 +11,7 @@
Sort by
- projects_sort_options_hash.each do |value, title|
%li
- = link_to filter_projects_path(sort: value, archived: archived), class: ("is-active" if @sort == value) do
+ = link_to filter_projects_path(sort: value, archived: archived, personal: personal), class: ("is-active" if @sort == value) do
= title
%li.divider
@@ -20,3 +21,10 @@
%li
= link_to filter_projects_path(sort: @sort, archived: true), class: ("is-active" if params[:archived].present?) do
Show archived projects
+ %li.divider
+ %li
+ = link_to filter_projects_path(sort: @sort, personal: nil), class: ("is-active" unless personal) do
+ Owned by anyone
+ %li
+ = link_to filter_projects_path(sort: @sort, personal: true), class: ("is-active" if personal) do
+ Owned by me