Skip to content

Commit

Permalink
created ITEMS_PLACEHOLDER constant
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Oct 22, 2019
1 parent 7775155 commit 3341dcc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/pagy/extras/items.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class Pagy
VARS[:items_param] = :items
VARS[:max_items] = 100

ITEMS_PLACEHOLDER = '__pagy_items__'

# Handle a custom number of :items from params
module Backend ; private

Expand Down Expand Up @@ -49,7 +51,7 @@ def pagy_url_for_with_items(page, pagy, url=false)
def pagy_items_selector_js(pagy, id=pagy_id)
p_vars = pagy.vars
p_items = p_vars[:items]
p_vars[:items] = '__pagy_items__'
p_vars[:items] = ITEMS_PLACEHOLDER
link = pagy_marked_link(pagy_link_proc(pagy))
p_vars[:items] = p_items # restore the items

Expand Down

0 comments on commit 3341dcc

Please sign in to comment.