Skip to content

Commit

Permalink
documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Jun 17, 2018
1 parent 42ba053 commit 1cc335b
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/api/backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This is the main method of this module. It takes a collection object (e.g. a sco
@pagy, @records = pagy(Product.my_scope, some_option: 'get merged in the pagy object')
```

The built-in `pagy` method is designed to be easy to customize by overriding any of the two sub-methods that it calls internally. You can independently change the default variables (`pagy_get_variables`) and/or the default page of items from the collection `pagy_get_items`).
The built-in `pagy` method is designed to be easy to customize by overriding any of the two sub-methods that it calls internally. You can independently change the default variables (`pagy_get_vars`) and/or the default page of items from the collection `pagy_get_items`).

If you need to use multiple different types of collections in the same app or action, you may want to define some alternative and self contained custom `pagy` method. (see [Writing your own Pagy methods](#writing-your-own-pagy-methods))

Expand Down
2 changes: 1 addition & 1 deletion docs/api/frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Displaying Products <b>476-500</b> of <b>1000</b> in total

See also [Using the pagy_info helper](../how-to.md#using-the-pagy_info-helper).

### pagy_url_for(page, page_param)
### pagy_url_for(page, pagy)

This method is called internally in order to produce the url of a page by passing it its number. For standard usage it works out of the box and you can just ignore it.

Expand Down
2 changes: 1 addition & 1 deletion docs/extras/responsive.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ In rails: add the javascript file to the application.js
//= require pagy-responsive
```

In non-rails apps: ensure the `pagy/extras/javascripts/pagy-responsive.js` script gets served with the page
In non-rails apps: ensure the `pagy/extras/javascripts/pagy-responsive.js` script gets served with the page.

Then use the responsive helper(s) in any view:

Expand Down
2 changes: 1 addition & 1 deletion docs/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ That will explicitly set the `:page` variable, overriding the default behavior (

Pagy uses the `:page_param` variable to determine the param it should get the page number from and create the URL for. Its default is set as `Pagy::VARS = :page`, hence it will get the page number from the `params[:page]` and will create page URLs like `./?page=3` by default.

You may want to customize that, for example to make it more readable in your language, or becuse you need to paginate different collections in the same action. Depending on the scope of the customization, you have couple of options:
You may want to customize that, for example to make it more readable in your language, or becuse you need to paginate different collections in the same action. Depending on the scope of the customization, you have a couple of options:

1. `Pagy::VARS[:page_param] = :custom_param` will be used as the global default
2. `pagy(scope, page_param: :custom_param)` or `Pagy.new(count:100, page_param: :custom_param)` will be used for a single instance (overriding the global default)
Expand Down
2 changes: 1 addition & 1 deletion lib/pagy/extras/array.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See the Pagy Extras documentation: https://ddnexus.github.io/pagy/extras
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/array

class Pagy
# Add specialized backend methods to paginate array collections
Expand Down
2 changes: 1 addition & 1 deletion lib/pagy/extras/bootstrap.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See the Pagy Extras documentation: https://ddnexus.github.io/pagy/extras
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/bootstrap

class Pagy
# Add nav helper for bootstrap pagination
Expand Down
2 changes: 1 addition & 1 deletion lib/pagy/extras/compact.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See the Pagy Extras documentation: https://ddnexus.github.io/pagy/extras
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/compact

class Pagy
# Add nav helpers for compact pagination
Expand Down
2 changes: 1 addition & 1 deletion lib/pagy/extras/i18n.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See the Pagy Extras documentation: https://ddnexus.github.io/pagy/extras
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/i18n

class Pagy
# Use ::I18n gem
Expand Down
7 changes: 2 additions & 5 deletions lib/pagy/extras/initializer_example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
# Responsive: On resize, the number of page links will adapt in real-time to the available window or container width
# See https://ddnexus.github.io/pagy/extras/responsive
# require 'pagy/extras/responsive'
# See https://ddnexus.github.io/pagy/extras/responsive#breakpoints
# Pagy::VARS[:breakpoints] = { 0 => [1,2,2,1], 350 => [2,3,3,2], 550 => [3,4,4,3] } # example of width/size pairs


# Pagy Variables
Expand All @@ -41,11 +43,6 @@
# Pagy::VARS[:link_extra] = 'data-remote="true"' # example
# Pagy::VARS[:item_path] = 'activerecord.models.product' # example

# Extras Non Core Variables
# See https://ddnexus.github.io/pagy/extras/responsive#breakpoints
# Pagy::VARS[:breakpoints] = { 0 => [1,2,2,1], 350 => [2,3,3,2], 550 => [3,4,4,3] } # example of width/size pairs


# Pagy::Frontend::I18N Constant
# See https://ddnexus.github.io/pagy/api/frontend#i18n
# Pagy::Frontend::I18N[:plurals] = -> (c) {([:zero, :one][c] || :other).to_s # default
Expand Down
2 changes: 2 additions & 0 deletions lib/pagy/extras/javascripts/pagy-compact.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// See the Pagy documentation: https://ddnexus.github.io/pagy/extras/compact

function PagyCompact(id, marker, page){
var pagyNav = document.getElementById('pagy-nav-'+id),
input = pagyNav.getElementsByTagName('input')[0],
Expand Down
2 changes: 2 additions & 0 deletions lib/pagy/extras/javascripts/pagy-responsive.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// See the Pagy documentation: https://ddnexus.github.io/pagy/extras/resposive

function PagyResponsive(id, items, widths, series){
var pagyNav = document.getElementById('pagy-nav-'+id),
pagyBox = pagyNav.firstChild || pagyNav,
Expand Down
2 changes: 1 addition & 1 deletion lib/pagy/extras/responsive.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See the Pagy Extras documentation: https://ddnexus.github.io/pagy/extras
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/responsive

require 'json'

Expand Down

0 comments on commit 1cc335b

Please sign in to comment.