Skip to content

Commit

Permalink
Merge branch 'feature/deprecation' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Nov 30, 2018
2 parents 645b57e + cd8256e commit e2ea5b6
Show file tree
Hide file tree
Showing 39 changed files with 580 additions and 463 deletions.
77 changes: 77 additions & 0 deletions DEPRECATIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# DEPRECATIONS

The helpers for all the frontend extras have been renamed in a more consistent way, following the same convention of the other extras.

## Renaming convenction

The method naming for the frontend extras follow the pattern: `<pagy-prefix>_<name-of-framework>_<qualifier>\_<result>` where:

- pagy-prefix: "pagy"
- name-of-framework: e.g. "bootstrap"
- qualifier: (optional) e.g."compact"
- result: e.g. "nav"

**Notice**: this convention applies only to the frontend extras.

## Renamed methods and files

The following methods (and one file) have been renamed and they will be removed in version 2.0. You only need to search and replace, because the funtionality has not been changed.

### Bootstrap Extra

| Legacy Name | New Name |
|:--------------------------------|:--------------------------------|
| `pagy_nav_bootstrap` | `pagy_bootstrap_nav` |
| `pagy_nav_compact_bootstrap` | `pagy_bootstrap_compact_nav` |
| `pagy_nav_responsive_bootstrap` | `pagy_bootstrap_responsive_nav` |

### Bulma Extra

| Legacy Name | New Name |
|:----------------------------|:----------------------------|
| `pagy_nav_bulma` | `pagy_bulma_nav` |
| `pagy_nav_compact_bulma` | `pagy_bulma_compact_nav` |
| `pagy_nav_responsive_bulma` | `pagy_bulma_responsive_nav` |

### Foundation Extra

| Legacy Name | New Name |
|:---------------------------------|:---------------------------------|
| `pagy_nav_foundation` | `pagy_foundation_nav` |
| `pagy_nav_compact_foundation` | `pagy_foundation_compact_nav` |
| `pagy_nav_responsive_foundation` | `pagy_foundation_responsive_nav` |

### Materialize Extra

| Legacy Name | New Name |
|:----------------------------------|:----------------------------------|
| `pagy_nav_materialize` | `pagy_materialize_nav` |
| `pagy_nav_compact_materialize` | `pagy_materialize_compact_nav` |
| `pagy_nav_responsive_materialize` | `pagy_materialize_responsive_nav` |

### Navs Extra

| Legacy Name | New Name |
|:-----------------------------|:------------------------------------|
| | `pagy_plain_nav` (`pagy_nav` alias) |
| `pagy_nav_compact` | `pagy_plain_compact_nav` |
| `pagy_nav_responsive` | `pagy_plain_responsive_nav` |
| `require "pagy/extras/navs"` | `require "pagy/extras/plain"` |

### Semantic Extra

| Legacy Name | New Name |
|:-------------------------------|:-------------------------------|
| `pagy_nav_semantic` | `pagy_semantic_nav` |
| `pagy_nav_compact_semantic` | `pagy_semantic_compact_nav` |
| `pagy_nav_responsive_semantic` | `pagy_semantic_responsive_nav` |

## Renamed classes and params in helpers

**Notice**: You can skip this section if you did not override any nav helper.

### CSS nav classes

The `nav` CSS classes follow the same renaming rules of the helper methods. For example:

`pagy-nav-responsive-bootstrap` is now `pagy-bootstrap-responsive-nav`
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ Use the official extras, or write your own in just a few lines. Extras add speci

### Frontend Extras

- [bootstrap](http://ddnexus.github.io/pagy/extras/bootstrap): Nav helpers and templates for the Bootstrap [pagination component](https://getbootstrap.com/docs/4.1/components/pagination)
- [bulma](http://ddnexus.github.io/pagy/extras/bulma): Nav helpers and templates for the Bulma CSS [pagination component](https://bulma.io/documentation/components/pagination)
- [foundation](http://ddnexus.github.io/pagy/extras/foundation): Nav helpers and templates for the Foundation [pagination component](https://foundation.zurb.com/sites/docs/pagination.html)
- [materialize](http://ddnexus.github.io/pagy/extras/materialize): Nav helpers for the Materialize CSS [pagination component](https://materializecss.com/pagination.html)
- [navs](http://ddnexus.github.io/pagy/extras/navs): Responsive and compact generic/unstyled nav helpers
- [semantic](http://ddnexus.github.io/pagy/extras/semantic): Nav helpers for the Semantic UI CSS [pagination component](https://semantic-ui.com/collections/menu.html)
- [bootstrap](http://ddnexus.github.io/pagy/extras/bootstrap): Add nav, responsive and compact helpers for the Bootstrap [pagination component](https://getbootstrap.com/docs/4.1/components/pagination)
- [bulma](http://ddnexus.github.io/pagy/extras/bulma): Add nav, responsive and compact helpers for the Bulma CSS [pagination component](https://bulma.io/documentation/components/pagination)
- [foundation](http://ddnexus.github.io/pagy/extras/foundation): Add nav, responsive and compact helpers for the Foundation [pagination component](https://foundation.zurb.com/sites/docs/pagination.html)
- [materialize](http://ddnexus.github.io/pagy/extras/materialize): Add nav responsive and compact helpers for the Materialize CSS [pagination component](https://materializecss.com/pagination.html)
- [plain](http://ddnexus.github.io/pagy/extras/plain): Add responsive and compact plain/unstyled helpers
- [semantic](http://ddnexus.github.io/pagy/extras/semantic): Add nav, responsive and compact helpers for the Semantic UI CSS [pagination component](https://semantic-ui.com/collections/menu.html)

### Feature Extras

Expand All @@ -116,9 +116,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/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)
- [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)

- [responsive nav](http://ddnexus.github.io/pagy/extras/navs#responsive-navs): On resize, the number of page links adapts in real-time to the available window or container width:<br>![pagy-responsive](docs/assets/images/pagy-responsive-w.png)
- [responsive nav](http://ddnexus.github.io/pagy/extras/plain#responsive-navs): On resize, the number of page links adapts in real-time to the available window or container width:<br>![pagy-responsive](docs/assets/images/pagy-responsive-w.png)

## Resources

Expand All @@ -141,6 +141,7 @@ Besides the classic pagination `nav`, Pagy offers a few ready to use alternative
- [Quick Start](https://ddnexus.github.io/pagy/how-to#quick-start)
- [Documentation](https://ddnexus.github.io/pagy/index)
- [Changelog](https://github.com/ddnexus/pagy/blob/master/CHANGELOG.md)
- [Deprecations](https://github.com/ddnexus/pagy/blob/master/DEPRECATIONS.md)

### Support and Feedback

Expand Down
2 changes: 1 addition & 1 deletion docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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/navs"><p class="indent1" {% if page.title == 'Navs' %}id="active"{% endif %} >Navs</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/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/trim"><p class="indent1" {% if page.title == 'Trim' %}id="active"{% endif %} >Trim</p></a>
Expand Down
2 changes: 1 addition & 1 deletion docs/api/countless.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The available values for the `:overflow` variable are `:empty_page` and `:except

### Features witout support

The `pagy_info` and all the `pagy_nav_compact*` helpers are not supported.
The `pagy_info` and all the `pagy_plain_compact_nav*` helpers are not supported.

## How countless pagination works

Expand Down
14 changes: 7 additions & 7 deletions docs/extras.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ Pagy comes with a few optional extensions/extras:
| Extra | Description | Links |
|:----------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `array` | Paginate arrays efficiently avoiding expensive array-wrapping and without overriding | [array.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/array.rb), [documentation](extras/array.md) |
| `bootstrap` | Nav, responsive and compact helpers and templates for the Bootstrap [pagination component](https://getbootstrap.com/docs/4.1/components/pagination) | [bootstrap.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/bootstrap.rb), [documentation](extras/bootstrap.md) |
| `bulma` | Nav, responsive and compact helpers and templates for the Bulma [pagination component](https://bulma.io/documentation/components/pagination) | [bulma.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/bulma.rb), [documentation](extras/bulma.md) |
| `countless` | Paginate without any count, saving one query per rendering | [countless.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/countless.rb), [documentation](extras/countless.md) |
| `bootstrap` | Add nav, responsive and compact helpers for the Bootstrap [pagination component](https://getbootstrap.com/docs/4.1/components/pagination) | [bootstrap.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/bootstrap.rb), [documentation](extras/bootstrap.md) |
| `bulma` | Add nav, responsive and compact helpers for the Bulma [pagination component](https://bulma.io/documentation/components/pagination) | [bulma.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/bulma.rb), [documentation](extras/bulma.md) |
| `countless` | Paginate without any count, saving one query per rendering | [countless.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/countless.rb), [documentation](extras/countless.md) |
| `elasticsearch_rails` | Paginate `elasticsearch_rails` gem results efficiently | [elasticsearch_rails.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/elasticsearch_rails.rb), [documentation](extras/elasticsearch_rails.md) |
| `foundation` | Nav, responsive and compact helpers and templates for the Foundation [pagination component](https://foundation.zurb.com/sites/docs/pagination.html) | [foundation.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/foundation.rb), [documentation](extras/foundation.md) |
| `foundation` | Add nav, responsive and compact helpers for the Foundation [pagination component](https://foundation.zurb.com/sites/docs/pagination.html) | [foundation.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/foundation.rb), [documentation](extras/foundation.md) |
| `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` | Nav, responsive and compact 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 responsive and compact generic/unstyled nav helpers | [navs.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/navs.rb), [documentation](extras/navs.md) |
| `materialize` | Add nav, responsive and compact 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) |
| `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 responsive and compact 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` | Nav 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, responsive and compact 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) |
| `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) |

## Synopsis
Expand Down
34 changes: 17 additions & 17 deletions docs/extras/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,53 +19,53 @@ Render the navigation links in some view...
with a fast helper:

```erb
<%== pagy_nav_bootstrap(@pagy) %>
<%== pagy_nav_responsive_bootstrap(@pagy) %>
<%== pagy_nav_compact_bootstrap(@pagy) %>
<%== pagy_bootstrap_nav(@pagy) %>
<%== pagy_bootstrap_responsive_nav(@pagy) %>
<%== pagy_bootstrap_compact_nav(@pagy) %>
```

or with a template:

```erb
<%== render 'pagy/nav_bootstrap', locals: {pagy: @pagy} %>
<%== render 'pagy/bootstrap_nav', locals: {pagy: @pagy} %>
```

Configure [javascript](../extras.md#javascript) if you use `pagy_nav_responsive_bootstrap` or `pagy_nav_compact_bootstrap`.
Configure [javascript](../extras.md#javascript) if you use `pagy_bootstrap_responsive_nav` or `pagy_bootstrap_compact_nav`.

## Files

This extra is composed of 4 files:

- [bootstrap.rb](https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/bootstrap.rb)
- [nav_bootstrap.html.erb](https://github.com/ddnexus/pagy/blob/master/lib/templates/nav_bootstrap.html.erb) (optional template)
- [nav_bootstrap.html.haml](https://github.com/ddnexus/pagy/blob/master/lib/templates/nav_bootstrap.html.haml) (optional template)
- [nav_bootstrap.html.slim](https://github.com/ddnexus/pagy/blob/master/lib/templates/nav_bootstrap.html.slim) (optional template)
- [bootstrap_nav.html.erb](https://github.com/ddnexus/pagy/blob/master/lib/templates/bootstrap_nav.html.erb) (optional template)
- [bootstrap_nav.html.haml](https://github.com/ddnexus/pagy/blob/master/lib/templates/bootstrap_nav.html.haml) (optional template)
- [bootstrap_nav.html.slim](https://github.com/ddnexus/pagy/blob/master/lib/templates/bootstrap_nav.html.slim) (optional template)

## Methods

This extra adds 3 nav helpers to the `Pagy::Frontend` module. You can customize them by overriding it directly in your own view helper.

### pagy_nav_bootstrap(pagy)
### pagy_bootstrap_nav(pagy)

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

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

### pagy_nav_compact_bootstrap(pagy, ...)
### pagy_bootstrap_compact_nav(pagy, ...)

This method is the same as the `pagy_nav_compact`, but customized for the Bootstrap framework.
This method is the same as the `pagy_plain_compact_nav`, but customized for the Bootstrap framework.

Here is an example:

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

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

### pagy_nav_responsive_bootstrap(pagy, ...)
### pagy_bootstrap_responsive_nav(pagy, ...)

This method is the same as the `pagy_nav_responsive`, but customized for the Bootstrap framework.
This method is the same as the `pagy_plain_responsive_nav`, but customized for the Bootstrap framework.

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

### Optional Template Files

Expand Down
Loading

0 comments on commit e2ea5b6

Please sign in to comment.