Skip to content

Commit

Permalink
renamed plain extra to navs; removed the "plain_" qualifier for the h…
Browse files Browse the repository at this point in the history
…elpers
  • Loading branch information
ddnexus committed Apr 28, 2019
1 parent 54f4a7e commit ad100eb
Show file tree
Hide file tree
Showing 15 changed files with 141 additions and 144 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Use the official extras, or write your own in just a few lines. Extras add speci
- [bulma](http://ddnexus.github.io/pagy/extras/bulma): Add nav, nav_js and compact_nav_js helpers for the Bulma CSS [pagination component](https://bulma.io/documentation/components/pagination)
- [foundation](http://ddnexus.github.io/pagy/extras/foundation): Add nav, nav_js and compact_nav_js helpers for the Foundation [pagination component](https://foundation.zurb.com/sites/docs/pagination.html)
- [materialize](http://ddnexus.github.io/pagy/extras/materialize): Add nav, nav_js and compact_nav_js helpers for the Materialize CSS [pagination component](https://materializecss.com/pagination.html)
- [plain](http://ddnexus.github.io/pagy/extras/plain): Add nav_js and compact_nav_js plain/unstyled helpers
- [navs](http://ddnexus.github.io/pagy/extras/navs): Add nav_js and compact_nav_js plain/unstyled helpers
- [semantic](http://ddnexus.github.io/pagy/extras/semantic): Add nav, nav_js and compact_nav_js helpers for the Semantic UI CSS [pagination component](https://semantic-ui.com/collections/menu.html)

### Feature Extras
Expand All @@ -128,9 +128,9 @@ Use the official extras, or write your own in just a few lines. Extras add speci

Besides the classic pagination `nav`, Pagy offers a few ready to use alternatives like:

- [compact nav](http://ddnexus.github.io/pagy/extras/plain#compact-navs): An alternative UI that combines the pagination feature with the navigation info in one compact element:<br>![pagy-compact](docs/assets/images/pagy-compact-w.png)
- [compact nav](http://ddnexus.github.io/pagy/extras/navs#compact-navs): An alternative UI that combines the pagination feature with the navigation info in one compact element:<br>![pagy-compact](docs/assets/images/pagy-compact-w.png)

- [nav_js](http://ddnexus.github.io/pagy/extras/plain#responsive-navs): A classic looking UI that fits the number of page links to the available width on the client-side:<br>![pagy-nav_js](docs/assets/images/pagy-nav_js-w.png)
- [nav_js](http://ddnexus.github.io/pagy/extras/navs#responsive-navs): A classic looking UI that fits the number of page links to the available width on the client-side:<br>![pagy-nav_js](docs/assets/images/pagy-nav_js-w.png)

## Resources

Expand Down
2 changes: 1 addition & 1 deletion docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h1 id="site-title">{{ site.title | default: site.github.repository_name }} <a c
<a href="{{ site.baseurl }}/extras/items"><p class="indent1" {% if page.title == 'Items' %}id="active"{% endif %} >Items</p></a>
<a href="{{ site.baseurl }}/extras/overflow"><p class="indent1" {% if page.title == 'Overflow' %}id="active"{% endif %} >Overflow</p></a>
<a href="{{ site.baseurl }}/extras/materialize"><p class="indent1" {% if page.title == 'Materialize' %}id="active"{% endif %} >Materialize</p></a>
<a href="{{ site.baseurl }}/extras/plain"><p class="indent1" {% if page.title == 'Plain' %}id="active"{% endif %} >Plain</p></a>
<a href="{{ site.baseurl }}/extras/navs"><p class="indent1" {% if page.title == 'Navs' %}id="active"{% endif %} >Navs</p></a>
<a href="{{ site.baseurl }}/extras/searchkick"><p class="indent1" {% if page.title == 'Searchkick' %}id="active"{% endif %} >Searchkick</p></a>
<a href="{{ site.baseurl }}/extras/semantic"><p class="indent1" {% if page.title == 'Semantic' %}id="active"{% endif %} >Semantic</p></a>
<a href="{{ site.baseurl }}/extras/support"><p class="indent1" {% if page.title == 'Support' %}id="active"{% endif %} >Support</p></a>
Expand Down
4 changes: 2 additions & 2 deletions docs/extras.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ Pagy comes with a few optional extensions/extras:
| `i18n` | Use the `I18n` gem instead of the pagy implementation | [i18n.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/i81n.rb), [documentation](extras/i18n.md) |
| `items` | Allow the client to request a custom number of items per page with a ready to use selector UI | [items.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/items.rb), [documentation](extras/items.md) |
| `materialize` | Add nav, nav_js and compact_nav_js helpers for the Materialize CSS [pagination component](https://materializecss.com/pagination.html) | [materialize.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/materialize.rb), [documentation](extras/materialize.md) |
| `navs` | Add nav_js and compact_nav_js javascript unstyled helpers | [navs.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/navs.rb), [documentation](extras/navs.md) |
| `overflow` | Allow for easy handling of overflowing pages | [overflow.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/overflow.rb), [documentation](extras/overflow.md) |
| `plain` | Add nav_js and compact_nav_js plain/unstyled helpers | [plain.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/plain.rb), [documentation](extras/plain.md) |
| `searchkick` | Paginate arrays efficiently avoiding expensive array-wrapping and without overriding | [searchkick.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/searchkick.rb), [documentation](extras/searchkick.md) |
| `semantic` | Add nav, nav_js and compact_nav_js helpers for the Semantic UI CSS [pagination component](https://semantic-ui.com/collections/menu.html) | [semantic.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/semantic.rb), [documentation](extras/semantic.md) |
| `semantic` | Add nav, nav_js and compact_nav_js helpers for the Semantic UI CSS [pagination component](https://semantic-ui.com/collections/menu.html) | [semantic.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/semantic.rb), [documentation](extras/semantic.md) |
| `support` | Extra support for features like: incremental, infinite, auto-scroll pagination | [support.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/support.rb), [documentation](extras/support.md) |
| `trim` | Remove the `page=1` param from links | [trim.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/trim.rb), [documentation](extras/trim.md) |

Expand Down
10 changes: 5 additions & 5 deletions docs/extras/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,25 @@ This extra adds 3 nav helpers to the `Pagy::Frontend` module. You can customize

### pagy_bootstrap_nav(pagy)

This method is the same as the `pagy_nav`/`pagy_plain_nav`, but customized for Bootstrap.
This method is the same as the `pagy_nav`, but customized for Bootstrap.

The `bootstrap_nav.*` templates produce the same output, and can be used as an easier (but slower) starting point to override it.

### pagy_bootstrap_compact_nav_js(pagy, ...)

This method is the same as the `pagy_plain_compact_nav_js`, but customized for the Bootstrap framework.
This method is the same as the `pagy_compact_nav_js`, but customized for the Bootstrap framework.

Here is an example:

![pagy-compact](../assets/images/pagy-compact-g.png)

See more details in the [javascript compact navs](plain.md#javascript-compact-navs) documentation.
See more details in the [javascript compact navs](navs.md#javascript-compact-navs) documentation.

### pagy_bootstrap_nav_js(pagy, ...)

This method is the same as the `pagy_plain_nav_js`, but customized for the Bootstrap framework.
This method is the same as the `pagy_nav_js`, but customized for the Bootstrap framework.

See more details in the [javascript navs](plain.md#javascript-navs) documentation.
See more details in the [javascript navs](navs.md#javascript-navs) documentation.

### Optional Template Files

Expand Down
10 changes: 5 additions & 5 deletions docs/extras/bulma.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,25 @@ This extra adds 3 nav helpers to the `Pagy::Frontend` module. You can customize

### pagy_bulma_nav(pagy)

This method is the same as the `pagy_nav`/`pagy_plain_nav`, but customized for Bulma.
This method is the same as the `pagy_nav`, but customized for Bulma.

The `bulma_nav.*` templates produce the same output, and can be used as an easier (but slower) starting point to override it.

### pagy_bulma_compact_nav_js(pagy, ...)

This method is the same as the `pagy_plain_compact_nav_js`, but customized for the Bulma CSS framework.
This method is the same as the `pagy_compact_nav_js`, but customized for the Bulma CSS framework.

Here is an example:

![pagy-compact-bulma](../assets/images/pagy-compact-bulma-g.png)

See more details in the [compact_navs_js](plain.md#javascript-compact-navs) documentation.
See more details in the [compact_navs_js](navs.md#javascript-compact-navs) documentation.

### pagy_bulma_nav_js(pagy, ...)

This method is the same as the `pagy_plain_nav_js`, but customized for the Bulma CSS framework.
This method is the same as the `pagy_nav_js`, but customized for the Bulma CSS framework.

See more details in the [javascript navs](plain.md#javascript-navs) documentation.
See more details in the [javascript navs](navs.md#javascript-navs) documentation.

### Optional Template Files

Expand Down
10 changes: 5 additions & 5 deletions docs/extras/foundation.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ This extra adds 3 nav helpers to the `Pagy::Frontend` module. You can customize

### pagy_foundation_nav(pagy)

This method is the same as the `pagy_nav`/`pagy_plain_nav`, but customized for Foundation.
This method is the same as the `pagy_nav`, but customized for Foundation.

The `foundation_nav.*` templates produce the same output, and can be used as an easier (but slower) starting point to override it.

### pagy_foundation_compact_nav_js(pagy, ...)

This method is the same as the `pagy_plain_compact_nav_js`, but customized for the Foundation framework.
This method is the same as the `pagy_compact_nav_js`, but customized for the Foundation framework.

See more details in the [compact_navs_js](plain.md#javascript-compact-navs) documentation.
See more details in the [compact_navs_js](navs.md#javascript-compact-navs) documentation.

### pagy_foundation_nav_js(pagy, ...)

This method is the same as the `pagy_plain_nav_js`, but customized for the Foundation framework.
This method is the same as the `pagy_nav_js`, but customized for the Foundation framework.

See more details in the [javascript navs](plain.md#javascript-navs) documentation.
See more details in the [javascript navs](navs.md#javascript-navs) documentation.

### Optional Template Files

Expand Down
10 changes: 5 additions & 5 deletions docs/extras/materialize.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ This extra adds 3 nav helpers to the `Pagy::Frontend` module. You can customize

### pagy_materialize_nav(pagy)

This method is the same as the `pagy_nav`/`pagy_plain_nav`, but customized for Materialize.
This method is the same as the `pagy_nav`, but customized for Materialize.

### pagy_materialize_compact_nav_js(pagy, ...)

This method is the same as the `pagy_plain_compact_nav_js`, but customized for the Materialize CSS framework.
This method is the same as the `pagy_compact_nav_js`, but customized for the Materialize CSS framework.

Here is an example:

![pagy-compact-materialize](../assets/images/pagy-compact-materialize-g.png)

See more details in the [compact_navs_js](plain.md#javascript-compact-navs) documentation.
See more details in the [compact_navs_js](navs.md#javascript-compact-navs) documentation.

### pagy_materialize_nav_js(pagy, ...)

This method is the same as the `pagy_plain_nav_js`, but customized for the Materialize CSS framework.
This method is the same as the `pagy_nav_js`, but customized for the Materialize CSS framework.

See more details in the [javascript navs](plain.md#javascript-navs) documentation.
See more details in the [javascript navs](navs.md#javascript-navs) documentation.

## Templates

Expand Down
20 changes: 10 additions & 10 deletions docs/extras/plain.md → docs/extras/navs.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: Plain
title: Navs
---
# Plain Extra
# Navs Extra

This extra adds a couple of nav helpers to the `Pagy::Frontend` module: `pagy_plain_compact_nav_js` and `pagy_plain_nav_js`. It also adds the `:pagy_plain_nav` alias (pointing to the `:pagy_nav` for naming consistency). These are the plain/unstyled nav helpers for pagination.
This extra adds a couple of javascript nav helpers to the `Pagy::Frontend` module: `pagy_compact_nav_js` and `pagy_nav_js`. These are the unstyled nav helpers for pagination.

Other extras (e.g. [bootstrap](bootstrap.md), [bulma](bulma.md), [foundation](foundation.md), [materialize](materialize.md), [semantic](semantic.md)) provide framework-styled versions of the same `nav`, `responsive` and `compact` helpers, so you may not need this extra if you use one of those.
Other extras (e.g. [bootstrap](bootstrap.md), [bulma](bulma.md), [foundation](foundation.md), [materialize](materialize.md), [semantic](semantic.md)) provide framework-styled versions of the same `nav`, `nav_js` and `compact_nav_js` helpers, so you may not need this extra if you use one of those.

## Synopsis

Expand All @@ -14,14 +14,14 @@ See [extras](../extras.md) for general usage info.
In the `pagy.rb` initializer:

```ruby
require 'pagy/extras/plain'
require 'pagy/extras/navs'
```

Configure [javascript](../extras.md#javascript).

## Files

- [plain.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/plain.rb)
- [navs.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/navs.rb)

# Javascript Compact Navs

Expand All @@ -34,7 +34,7 @@ It is especially useful for small size screens, but it is used also with wide la
Use the `*_compact_nav_js helpers in any view:

```erb
<%== pagy_plain_compact_nav_js(@pagy) %>
<%== pagy_compact_nav_js(@pagy) %>
```

Other extras provide also the following framework-styled helpers:
Expand All @@ -49,7 +49,7 @@ Other extras provide also the following framework-styled helpers:

## Methods

### pagy_plain_compact_nav_js(pagy, ...)
### pagy_compact_nav_js(pagy, ...)

Renders a compact navigation with a style similar to the `pagy_nav` helper.

Expand All @@ -75,7 +75,7 @@ Pagy::VARS[:sizes] = { 0 => [1,0,0,1], 540 => [2,3,3,2], 720 => [3,4,4,3] }
Use the `*_nav_js` helpers in any view:

```erb
<%== pagy_plain_nav_js(@pagy) %>
<%== pagy_nav_js(@pagy) %>
```

Other extras provide also the following framework-styled helpers:
Expand Down Expand Up @@ -134,7 +134,7 @@ Here is what you should consider/ensure:

## Methods

### pagy_plain_nav_js(pagy, ...)
### pagy_nav_js(pagy, ...)

Similar to the `pagy_nav` helper, with added responsiveness.

Expand Down
10 changes: 5 additions & 5 deletions docs/extras/semantic.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ This extra adds 3 nav helpers to the `Pagy::Frontend` module. You can customize

### pagy_semantic_nav(pagy)

This method is the same as the `pagy_nav`/`pagy_plain_nav`, but customized for Semantic UI.
This method is the same as the `pagy_nav`, but customized for Semantic UI.

### pagy_semantic_compact_nav_js(pagy, ...)

This method is the same as the `pagy_plain_compact_nav_js`, but customized for the Semantic UI framework.
This method is the same as the `pagy_compact_nav_js`, but customized for the Semantic UI framework.

See more details in the [compact_navs_js](plain.md#javascript-compact-navs) documentation.
See more details in the [compact_navs_js](navs.md#javascript-compact-navs) documentation.

### pagy_semantic_nav_js(pagy, ...)

This method is the same as the `pagy_plain_nav_js`, but customized for the Semantic UI framework.
This method is the same as the `pagy_nav_js`, but customized for the Semantic UI framework.

See more details in the [javascript navs](plain.md#javascript-navs) documentation.
See more details in the [javascript navs](navs.md#javascript-navs) documentation.

## Templates

Expand Down
2 changes: 1 addition & 1 deletion docs/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ These helpers take the Pagy object and return the HTML string with the paginatio
| [bulma](extras/bulma.md) | `pagy_bulma_nav`, `pagy_bulma_compact_nav_js`, `pagy_bulma_nav_js` |
| [foundation](extras/foundation.md) | `pagy_foundation_nav`, `pagy_foundation_compact_nav_js`, `pagy_foundation_nav_js` |
| [materialize](extras/materialize.md) | `pagy_materialize_nav`, `pagy_materialize_compact_nav_js`, `pagy_materialize_nav_js` |
| [plain](extras/plain.md) | `pagy_plain_nav`, `pagy_plain_compact_nav_js`, `pagy_plain_nav_js` |
| [navs](extras/navs.md) | `pagy_compact_nav_js`, `pagy_nav_js` |
| [semantic](extras/semantic.md) | `pagy_semantic_nav`, `pagy_semantic_compact_nav_js`, `pagy_semantic_nav_js` |

Helpers are the preferred choice (over templates) for their performance. If you need to override a `pagy_nav*` helper you can copy and paste it in your helper and edit it there. It is a simple concatenation of strings with a very simple logic.
Expand Down
12 changes: 6 additions & 6 deletions lib/config/pagy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@
# See https://ddnexus.github.io/pagy/extras/materialize
# require 'pagy/extras/materialize'

# Plain extra: Add nav_js and compact_nav_js plain helpers
# Navs extra: Add nav_js and compact_nav_js javascript helpers
# Notice: the other frontend extras add their own framework-styled versions,
# so require this extra only if you need the plain unstyled version
# See https://ddnexus.github.io/pagy/extras/plain
# require 'pagy/extras/plain'
# so require this extra only if you need the unstyled version
# See https://ddnexus.github.io/pagy/extras/navs
# require 'pagy/extras/navs'

# Semantic extra: Add nav, nav_js and compact_nav_js helpers for Semantic UI pagination
# See https://ddnexus.github.io/pagy/extras/semantic
# require 'pagy/extras/semantic'

# Multi size var used by the *_nav_js helpers
# See https://ddnexus.github.io/pagy/extras/plain#sizes
# Pagy::VARS[:sizes] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] }
# See https://ddnexus.github.io/pagy/extras/navs#sizes
# Pagy::VARS[:sizes] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] } # example


# Feature Extras
Expand Down
Loading

0 comments on commit ad100eb

Please sign in to comment.