Skip to content

Commit

Permalink
Fix inconsistencies with the :anchor_string documentation (closes #711)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Jun 10, 2024
1 parent c5dfc7f commit 6ac20fb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions docs/api/javascript/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ order: 4
# Javascript Setup

!!!info Notice
A javascript setup is required only for the `pagy*_js` helpers. Just using something like `anchor_string: 'data-remote="true"'` in
any other helper works out of the box.
A javascript setup is required only for the `pagy*_js` helpers. Just using something like `anchor_string: 'data-remote="true"'` in any instances works out of the box with any helper and without this setup.
!!!

!!!primary
Expand Down
5 changes: 1 addition & 4 deletions docs/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,10 @@ enough to pass some extra attribute string with the `:anchor_string` variable. F
Pagy::DEFAULT[:anchor_string] = 'data-remote="true"'

# for a single Pagy instance (if you use the Pagy::Backend#pagy method)
@pagy, @records = pagy(my_scope, anchor_string: 'data-remote="true"')
@pagy, @records = pagy(collection, anchor_string: 'data-remote="true"')

# or directly to the constructor
pagy = Pagy.new(count: 1000, anchor_string: 'data-remote="true"')

# or from a view: e.g.:
< %== pagy_bootstrap_nav(@pagy, anchor_string: 'data-action="hello#world"') % >
```

_See more advanced details about [The anchor_string variable](api/frontend.md#the-anchor_string-variable)_
Expand Down
7 changes: 5 additions & 2 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ should be uniquely aria-identified in the page.
!!!
<hr>

!!!danger Don't duplicate attributes with `anchor_string`!
!!!danger Don't duplicate attributes with the `:anchor_string`!

```ruby
@pagy, @records = pagy_bootstrap_nav(collection, anchor_string: 'class="my-class"')
@pagy, @records = pagy(collection, anchor_string: 'class="my-class"')
```
```erb
<%== pagy_bootstrap_nav(@pagy, **vars) %>
```

The `class` attribute with a value of `"pagination"` is already added by the `pagy_bootstrap_nav` so it's a duplicate HTML
Expand Down

0 comments on commit 6ac20fb

Please sign in to comment.