Sha256: d3cc6a3cc0bbd2ebcc7f39136775371c7e22766301d7553dc8eb237375ae2efe

Contents?: true

Size: 837 Bytes

Versions: 9

Compression:

Stored size: 837 Bytes

Contents

include_set Abstract::PagingParams

format do
  def offset
    search_params[:offset] || 0
  end

  def search_params
    @search_params ||= default_search_params
  end

  # used for override
  def default_search_params
    if (qparams = query_params)
      paging_params.merge vars: qparams
    else
      paging_params
    end
  end

  def paging_params
    { limit: limit_param, offset: offset_param }
  end

  def query_params
    return nil unless (vars = params[:query])
    Card.safe_param vars
  end

  def default_limit
    100
  end
end

format :html do
  def default_limit
    Cardio.config.paging_limit || 20
  end

  def extra_paging_path_args
    return {} unless (vars = query_params)
    { query: vars }
  end
end

format :json do
  def default_limit
    20
  end
end

format :rss do
  def default_limit
    25
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
card-1.96.8 mod/search/set/abstract/02_search_params.rb
card-1.96.7 mod/search/set/abstract/02_search_params.rb
card-1.96.6 mod/search/set/abstract/02_search_params.rb
card-1.96.5 mod/search/set/abstract/02_search_params.rb
card-1.96.4 mod/search/set/abstract/02_search_params.rb
card-1.96.3 mod/search/set/abstract/02_search_params.rb
card-1.96.2 mod/search/set/abstract/02_search_params.rb
card-1.96.1 mod/search/set/abstract/02_search_params.rb
card-1.96.0 mod/search/set/abstract/02_search_params.rb