Sha256: 274da367391ccd28519de2b8784b0ba34c2444d9185a6326c6bf3925a2d89bbe

Contents?: true

Size: 1.05 KB

Versions: 37

Compression:

Stored size: 1.05 KB

Contents

module Effective
  module EffectiveDatatable
    module Params

      private

      def datatables_ajax_request?
        return @_datatables_ajax_request unless @_datatables_ajax_request.nil?

        @_datatables_ajax_request =
          (view && view.params[:draw] && view.params[:columns] && cookie_keys.include?(view.params[:cookie])) == true
      end

      def params
        return {} unless view.present?
        @params ||= {}.tap do |params|
          Rack::Utils.parse_query(URI(view.request.referer.presence || '/').query).each { |k, v| params[k.to_sym] = v }
          view.params.each { |k, v| params[k.to_sym] = v }
        end
      end

      def filter_params
        params.select { |name, value| _filters.key?(name.to_sym) }
      end

      def scope_param
        params[:scope].to_sym if params.key?(:scope)
      end

      def search_params
        params.select do |name, value|
          columns.key?(name) && (name != :id) && !value.kind_of?(Hash) && value.class.name != 'ActionController::Parameters'.freeze
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
effective_datatables-3.6.3 app/models/effective/effective_datatable/params.rb
effective_datatables-3.6.1 app/models/effective/effective_datatable/params.rb
effective_datatables-3.6.0 app/models/effective/effective_datatable/params.rb
effective_datatables-3.5.4 app/models/effective/effective_datatable/params.rb
effective_datatables-3.5.3 app/models/effective/effective_datatable/params.rb
effective_datatables-3.5.2 app/models/effective/effective_datatable/params.rb
effective_datatables-3.5.0 app/models/effective/effective_datatable/params.rb
effective_datatables-3.4.8 app/models/effective/effective_datatable/params.rb
effective_datatables-3.4.7 app/models/effective/effective_datatable/params.rb
effective_datatables-3.4.6 app/models/effective/effective_datatable/params.rb
effective_datatables-3.4.5 app/models/effective/effective_datatable/params.rb
effective_datatables-3.4.4 app/models/effective/effective_datatable/params.rb
effective_datatables-3.4.3 app/models/effective/effective_datatable/params.rb
effective_datatables-3.4.2 app/models/effective/effective_datatable/params.rb
effective_datatables-3.4.1 app/models/effective/effective_datatable/params.rb
effective_datatables-3.4.0 app/models/effective/effective_datatable/params.rb
effective_datatables-3.3.14 app/models/effective/effective_datatable/params.rb
effective_datatables-3.3.13 app/models/effective/effective_datatable/params.rb
effective_datatables-3.3.12 app/models/effective/effective_datatable/params.rb
effective_datatables-3.3.11 app/models/effective/effective_datatable/params.rb