openstreetmap-website

https://github.com/openstreetmap/openstreetmap-website

Ruby

The Rails application that powers OpenStreetMap

ActionView::Helpers::PaginationHelper#pagination_links_each

Iterate through the pages of a given +paginator+, invoking a
block for each page number that needs to be rendered as a link.

==== Options
<tt>:window_size</tt>::          the number of pages to show around
                                 the current page (defaults to +2+)
<tt>:always_show_anchors</tt>::  whether or not the first and last
                                 pages should always be shown
                                 (defaults to +true+)
<tt>:link_to_current_page</tt>:: whether or not the current page
                                 should be linked to (defaults to
                                 +false+)

==== Example
 # Turn paginated links into an Ajax call
 pagination_links_each(paginator, page_options) do |link|
   options = { :url => {:action => 'list'}, :update => 'results' }
   html_options = { :href => url_for(:action => 'list') }

   link_to_remote(link.to_s, options, html_options)
 end

Source | Google | Stack overflow

Edit

git clone [email protected]:openstreetmap/openstreetmap-website.git

cd openstreetmap-website

open lib/classic_pagination/pagination_helper.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-ActionView--Helpers--PaginationHelper-pagination_links_each-for-pr


# Commit to git

git add lib/classic_pagination/pagination_helper.rbgit commit -m "better docs for ActionView::Helpers::PaginationHelper#pagination_links_each"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-ActionView--Helpers--PaginationHelper-pagination_links_each-for-pr

hub pull-request


# Celebrate!