summaryrefslogtreecommitdiff
path: root/app/finders/groups/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/finders/groups/base.rb')
-rw-r--r--app/finders/groups/base.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/finders/groups/base.rb b/app/finders/groups/base.rb
new file mode 100644
index 00000000000..d7f56b1a7a6
--- /dev/null
+++ b/app/finders/groups/base.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Groups
+ class Base
+ private
+
+ def sort(items)
+ items.order(Group.arel_table[:path].asc, Group.arel_table[:id].asc) # rubocop: disable CodeReuse/ActiveRecord
+ end
+
+ def by_search(items)
+ return items if params[:search].blank?
+
+ items.search(params[:search], include_parents: true)
+ end
+ end
+end