Sha256: b9f709c7d683b3f49abd46b6b934ebaede1add3b3a7b6afbccca1f4402fcff84

Contents?: true

Size: 745 Bytes

Versions: 28

Compression:

Stored size: 745 Bytes

Contents

module Para
  module Admin
    class SearchController < ApplicationController
      include Para::Helpers::ResourceName

      def index
        # Parse ids that are provided as string into array
        if params[:q] && params[:q][:id_in].is_a?(String)
          params[:q][:id_in] = params[:q][:id_in].split(',')
        end

        model = params[:model_name].constantize
        @results = model.ransack(params[:q]).result
        @results = @results.limit(params[:limit]) if params[:limit]

        case params[:mode]
        when "selectize"
          render json: @results.map { |res|
            { text: resource_name(res), value: res.id }
          }
        else
          render layout: false
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
para-0.12.4 app/controllers/para/admin/search_controller.rb
para-0.12.3 app/controllers/para/admin/search_controller.rb
para-0.12.2 app/controllers/para/admin/search_controller.rb
para-0.12.1 app/controllers/para/admin/search_controller.rb
para-0.12.0 app/controllers/para/admin/search_controller.rb
para-0.11.4 app/controllers/para/admin/search_controller.rb
para-0.11.3 app/controllers/para/admin/search_controller.rb
para-0.11.2 app/controllers/para/admin/search_controller.rb
para-0.11.1 app/controllers/para/admin/search_controller.rb
para-0.11.0 app/controllers/para/admin/search_controller.rb
para-0.10.0 app/controllers/para/admin/search_controller.rb
para-0.9.4 app/controllers/para/admin/search_controller.rb
para-0.9.3.3 app/controllers/para/admin/search_controller.rb
para-0.9.3.2 app/controllers/para/admin/search_controller.rb
para-0.9.3.1 app/controllers/para/admin/search_controller.rb
para-0.9.2 app/controllers/para/admin/search_controller.rb
para-0.9.0 app/controllers/para/admin/search_controller.rb
para-0.8.15 app/controllers/para/admin/search_controller.rb
para-0.8.14 app/controllers/para/admin/search_controller.rb
para-0.8.13 app/controllers/para/admin/search_controller.rb