Sha256: 7f7cf2e6e1c8aaa2fcee6a1bb3d75404322d3bb9ff811b7bbcfab99ef05dbac7

Contents?: true

Size: 649 Bytes

Versions: 8

Compression:

Stored size: 649 Bytes

Contents

class NeatPages::Helpers::Status < NeatPages::Helpers::Builder
  def generate
    return '' if empty? or out_of_bound?

    from, to = get_from_to_data

    return build_status from, to
  end

  def build_status(from, to)
    reset_builder

    b '<span data-neat-pages-control="status" id="neat-pages-status">'
    b "<span class=\"from\">#{from+1}</span>"
    b " #{t('to')} "
    b "<span class=\"to\">#{to}</span>/"
    b "<span class=\"total\">#{total_items}</span>"
    b '</span>'

    return b
  end

  def get_from_to_data
    from = offset
    to = from + per_page
    to = total_items if to > total_items

    return [from, to]
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
neat-pages-0.1.7 lib/neat_pages/helpers/status.rb
neat-pages-0.1.6 lib/neat_pages/helpers/status.rb
neat-pages-0.1.5 lib/neat_pages/helpers/status.rb
neat-pages-0.1.4 lib/neat_pages/helpers/status.rb
neat-pages-0.1.3 lib/neat_pages/helpers/status.rb
neat-pages-0.1.2 lib/neat_pages/helpers/status.rb
neat-pages-0.1.1 lib/neat_pages/helpers/status.rb
neat-pages-0.1.0 lib/neat_pages/helpers/status.rb