2016-03-04 15:11:33 +00:00
|
|
|
# == 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
|
|
|
|
2016-03-04 15:11:33 +00:00
|
|
|
projects
|
|
|
|
end
|
|
|
|
end
|