Sha256: 7a76820a1000258d9fbcb979ee034e785fa0ae0422daec66b2d2389b79be27c8

Contents?: true

Size: 756 Bytes

Versions: 13

Compression:

Stored size: 756 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class SearchesController < Decidim::ApplicationController
    include Rectify::ControllerHelpers
    include FormFactory
    include FilterResource
    include Paginable

    helper Decidim::FiltersHelper
    helper_method :term

    def index
      Search.call(term, current_organization, filters) do
        on(:ok) do |results|
          expose(results: results.page(params[:page]).per(params[:per_page]))
        end
      end
    end

    private

    def default_filter_params
      {
        term: params[:term],
        resource_type: nil,
        decidim_scope_id: nil
      }
    end

    def term
      @term ||= filter_params[:term]
    end

    def filters
      filter_params
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-core-0.15.2 app/controllers/decidim/searches_controller.rb
decidim-core-0.15.1 app/controllers/decidim/searches_controller.rb
decidim-core-0.15.0 app/controllers/decidim/searches_controller.rb
decidim-core-0.14.4 app/controllers/decidim/searches_controller.rb
decidim-core-0.14.3 app/controllers/decidim/searches_controller.rb
decidim-core-0.14.2 app/controllers/decidim/searches_controller.rb
decidim-core-0.14.1 app/controllers/decidim/searches_controller.rb
decidim-core-0.13.1 app/controllers/decidim/searches_controller.rb
decidim-core-0.12.2 app/controllers/decidim/searches_controller.rb
decidim-core-0.13.0 app/controllers/decidim/searches_controller.rb
decidim-core-0.12.1 app/controllers/decidim/searches_controller.rb
decidim-core-0.13.0.pre1 app/controllers/decidim/searches_controller.rb
decidim-core-0.12.0 app/controllers/decidim/searches_controller.rb