gitlab-org--gitlab-foss/app/controllers/concerns/filter_projects.rb

18 lines
471 B
Ruby
Raw Normal View History

# == FilterProjects
#
# Controller concern to handle projects filtering
# * by name
# * by archived state
#
module FilterProjects
extend ActiveSupport::Concern
def filter_projects(projects)
projects = projects.search(params[:filter_projects]) if params[:filter_projects].present?
projects = projects.non_archived if params[:archived].blank?
2016-04-21 21:02:00 +00:00
projects = projects.personal(current_user) if params[:personal].present? && current_user
2016-04-16 02:35:48 +00:00
projects
end
end