Sha256: af08fad2fc44777ce88fd5768c4dec35022d95254f1e9cc778a8481128fbe04f

Contents?: true

Size: 662 Bytes

Versions: 11

Compression:

Stored size: 662 Bytes

Contents

include_set Abstract::PagingParams

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

  def search_params
    @search_params ||= begin
      p = default_search_params.clone
      offset_and_limit_search_params p if focal?
      p
    end
  end

  def default_search_params
    { limit: default_limit }
  end

  def default_limit
    100
  end

  def offset_and_limit_search_params hash
    hash[:offset] = offset_param
    hash[:limit] = limit_param
  end
end

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

format :json do
  def default_limit
    0
  end
end

format :rss do
  def default_limit
    25
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
card-1.93.5 mod/search/set/abstract/01_search_params.rb
card-1.93.4 mod/search/set/abstract/01_search_params.rb
card-1.93.3 mod/search/set/abstract/01_search_params.rb
card-1.93.2 mod/search/set/abstract/01_search_params.rb
card-1.93.1 mod/search/set/abstract/01_search_params.rb
card-1.93.0 mod/search/set/abstract/01_search_params.rb
card-1.92.2 mod/standard/set/abstract/01_search_params.rb
card-1.92.1 mod/standard/set/abstract/01_search_params.rb
card-1.92 mod/standard/set/abstract/01_search_params.rb
card-1.91 mod/standard/set/abstract/01_search_params.rb
card-1.21.0 mod/standard/set/abstract/01_search_params.rb