GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - c7/leaf: A simple pagination library based on the agnostic branch of will_paginate

BranchesTags
Open more actions menu

Latest commit

 

History

33 Commits
33 Commits

Folders and files

NameName
Last commit message
Last commit date
lib
lib
 
 
spec
spec
 
 
.gitignore
.gitignore
 
 
MIT-LICENSE
MIT-LICENSE
 
 
README.rdoc
README.rdoc
 
 
Rakefile
Rakefile
 
 
leaf.gemspec
leaf.gemspec
 
 

Repository files navigation

Leaf

A really simple pagination library, heavily based on the agnostic branch of will_paginate.

Description

Leaf supports pagination for collections responding to total_pages, per_page, previous_page and total_entries in Sinatra views out of the box.

It currently supports two renderers: Leaf::ViewHelpers::LinkRenderer and Leaf::ViewHelpers::ListRenderer

Installation

gem install leaf

Example usage

require 'rubygems'
require 'sinatra'
require 'leaf'

include Leaf::ViewHelpers::Base

# Needed to paginate any array
# you’ll probably use something else.
require 'leaf/array'

get '/' do
  page = (params[:page]) ? params[:page] : 1
  array = ('a'..'z').to_a

  haml :index, :locals => { 
    :collection => array.paginate({
      :page => page, 
      :per_page => 5
    }) 
  }
end

__END__
@@ index
= leaf(collection, :renderer => Leaf::ViewHelpers::ListRenderer)
%ul
  - collection.each do |letter|
    %li= letter

Authors and credits

Leaf is based on will_paginate which was originally written by PJ Hyett, who later handed over development to Mislav Marohnić. (The library was completely rewritten since then.)

About

A simple pagination library based on the agnostic branch of will_paginate

c7.github.com/leaf/

Resources

Readme
MIT license
Activity
Custom properties

Stars

12 stars

Watchers

0 watching

Forks

4 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.