2022-10-11 01:57:18 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Groups
|
|
|
|
class Base
|
|
|
|
private
|
|
|
|
|
|
|
|
def sort(items)
|
2023-04-23 21:23:45 +05:30
|
|
|
items.reorder(Group.arel_table[:path].asc, Group.arel_table[:id].asc) # rubocop: disable CodeReuse/ActiveRecord
|
2022-10-11 01:57:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def by_search(items)
|
|
|
|
return items if params[:search].blank?
|
|
|
|
|
|
|
|
items.search(params[:search], include_parents: true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|