Sha256: d622a5ba1f1f43c8419c367455c7a9460c409a220f3c263367e6498a50287ef2
Contents?: true
Size: 1.01 KB
Versions: 8
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true module Decidim module Meetings # This class handles search and filtering of meetings. Needs a # `current_component` param with a `Decidim::Component` in order to # find the meetings. class MeetingSearch < ResourceSearch text_search_fields :title, :description # Public: Initializes the service. # component - A Decidim::Component to get the meetings from. # page - The page number to paginate the results. # per_page - The number of proposals to return per page. def initialize(options = {}) scope = options.fetch(:scope, Meeting.all) super(scope, options) end # Handle the date filter def search_date apply_scopes(%w(upcoming past), date) end def search_space return query if options[:space].blank? || options[:space] == "all" query.joins(:component).where(decidim_components: { participatory_space_type: options[:space].classify }) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems