Skip to content

Commit

Permalink
fix for temp items variable in items extra (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Jan 22, 2019
1 parent 510210c commit 3ead159
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/pagy/extras/items.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ def pagy_url_for_with_items(page, pagy)

# Return the items selector HTML. For example "Show [20] items per page"
def pagy_items_selector(pagy, id=pagy_id)
pagy = pagy.clone; p_vars = pagy.vars; p_items = p_vars[:items]; p_vars[:items] = "#{MARKER}-items-"
p_vars = pagy.vars; p_items = p_vars[:items]; p_vars[:items] = "#{MARKER}-items-"

html = +%(<span id="#{id}">)
html << %(<a href="#{pagy_url_for("#{MARKER}-page-", pagy)}"></a>)
p_vars[:items] = p_items # restore the items
input = %(<input type="number" min="1" max="#{p_vars[:max_items]}" value="#{p_items}" style="padding: 0; text-align: center; width: #{p_items.to_s.length+1}rem;">)
html << %(#{pagy_t('pagy.items', items_input: input, count: p_items)})
html << %(</span>#{pagy_json_tag(:items, id, MARKER, pagy.from)})
Expand Down

0 comments on commit 3ead159

Please sign in to comment.