Skip to content

Commit

Permalink
automatic ids based on hash must be strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Dec 1, 2018
1 parent e2ea5b6 commit 98ce8e7
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions lib/pagy/extras/bootstrap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def pagy_bootstrap_nav(pagy)

# Compact pagination for bootstrap: it returns the html with the series of links to the pages
# we use a numeric input tag to set the page and the Pagy.compact javascript to navigate
def pagy_bootstrap_compact_nav(pagy, id=caller(1,1)[0].hash)
def pagy_bootstrap_compact_nav(pagy, id=caller(1,1)[0].hash.to_s)
html, link, p_prev, p_next, p_page, p_pages = +'', pagy_link_proc(pagy), pagy.prev, pagy.next, pagy.page, pagy.pages

html << %(<nav id="pagy-nav-#{id}" class="pagy-nav-compact-bootstrap pagy-bootstrap-compact-nav pagination" role="navigation" aria-label="pager">)
Expand All @@ -45,7 +45,7 @@ def pagy_bootstrap_compact_nav(pagy, id=caller(1,1)[0].hash)

# Responsive pagination for bootstrap: it returns the html with the series of links to the pages
# rendered by the Pagy.responsive javascript
def pagy_bootstrap_responsive_nav(pagy, id=caller(1,1)[0].hash)
def pagy_bootstrap_responsive_nav(pagy, id=caller(1,1)[0].hash.to_s)
tags, link, p_prev, p_next, responsive = {}, pagy_link_proc(pagy, 'class="page-link"'), pagy.prev, pagy.next, pagy.responsive

tags['before'] = +'<ul class="pagination">'
Expand Down
4 changes: 2 additions & 2 deletions lib/pagy/extras/bulma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def pagy_bulma_nav(pagy)

# Compact pagination for Bulma: it returns the html with the series of links to the pages
# we use a numeric input tag to set the page and the Pagy.compact javascript to navigate
def pagy_bulma_compact_nav(pagy, id=caller(1,1)[0].hash)
def pagy_bulma_compact_nav(pagy, id=caller(1,1)[0].hash.to_s)
html, link, p_prev, p_next, p_page, p_pages = +'', pagy_link_proc(pagy), pagy.prev, pagy.next, pagy.page, pagy.pages

html << %(<nav id="pagy-nav-#{id}" class="pagy-nav-compact-bulma pagy-bulma-compact-nav" role="navigation" aria-label="pagination">)
Expand All @@ -47,7 +47,7 @@ def pagy_bulma_compact_nav(pagy, id=caller(1,1)[0].hash)

# Responsive pagination for Bulma: it returns the html with the series of links to the pages
# rendered by the Pagy.responsive javascript
def pagy_bulma_responsive_nav(pagy, id=caller(1,1)[0].hash)
def pagy_bulma_responsive_nav(pagy, id=caller(1,1)[0].hash.to_s)
tags, link, p_prev, p_next, responsive = {}, pagy_link_proc(pagy), pagy.prev, pagy.next, pagy.responsive

tags['before'] = +(p_prev ? link.call(p_prev, pagy_t('pagy.nav.prev'), 'class="pagination-previous" aria-label="previous page"')
Expand Down
4 changes: 2 additions & 2 deletions lib/pagy/extras/foundation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def pagy_foundation_nav(pagy)

# Compact pagination for Foundation: it returns the html with the series of links to the pages
# we use a numeric input tag to set the page and the Pagy.compact javascript to navigate
def pagy_foundation_compact_nav(pagy, id=caller(1,1)[0].hash)
def pagy_foundation_compact_nav(pagy, id=caller(1,1)[0].hash.to_s)
html, link, p_prev, p_next, p_page, p_pages = +'', pagy_link_proc(pagy), pagy.prev, pagy.next, pagy.page, pagy.pages

html << %(<nav id="pagy-nav-#{id}" class="pagy-nav-compact-foundation pagy-foundation-compact-nav" role="navigation" aria-label="Pagination">)
Expand All @@ -45,7 +45,7 @@ def pagy_foundation_compact_nav(pagy, id=caller(1,1)[0].hash)

# Responsive pagination for Foundation: it returns the html with the series of links to the pages
# rendered by the Pagy.responsive javascript
def pagy_foundation_responsive_nav(pagy, id=caller(1,1)[0].hash)
def pagy_foundation_responsive_nav(pagy, id=caller(1,1)[0].hash.to_s)
tags, link, p_prev, p_next, responsive = {}, pagy_link_proc(pagy), pagy.prev, pagy.next, pagy.responsive

tags['before'] = +'<ul class="pagination">'
Expand Down
2 changes: 1 addition & 1 deletion lib/pagy/extras/items.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def pagy_url_for_with_items(page, pagy)
alias_method :pagy_url_for, :pagy_url_for_with_items

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

html = +%(<span id="pagy-items-#{id}">)
Expand Down
4 changes: 2 additions & 2 deletions lib/pagy/extras/materialize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def pagy_materialize_nav(pagy)

# Compact pagination for materialize: it returns the html with the series of links to the pages
# we use a numeric input tag to set the page and the Pagy.compact javascript to navigate
def pagy_materialize_compact_nav(pagy, id=caller(1,1)[0].hash)
def pagy_materialize_compact_nav(pagy, id=caller(1,1)[0].hash.to_s)
html, link, p_prev, p_next, p_page, p_pages = +'', pagy_link_proc(pagy), pagy.prev, pagy.next, pagy.page, pagy.pages

html << %(<div id="pagy-nav-#{id}" class="pagy-nav-compact-materialize pagy-materialize-compact-nav pagination" role="navigation" aria-label="pager">)
Expand All @@ -46,7 +46,7 @@ def pagy_materialize_compact_nav(pagy, id=caller(1,1)[0].hash)

# Responsive pagination for Materialize: it returns the html with the series of links to the pages
# rendered by the Pagy.responsive javascript
def pagy_materialize_responsive_nav(pagy, id=caller(1,1)[0].hash)
def pagy_materialize_responsive_nav(pagy, id=caller(1,1)[0].hash.to_s)
tags, link, p_prev, p_next, responsive = {}, pagy_link_proc(pagy), pagy.prev, pagy.next, pagy.responsive

tags['before'] = +'<ul class="pagination">'
Expand Down
4 changes: 2 additions & 2 deletions lib/pagy/extras/plain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Frontend

# Plain compact pagination: it returns the html with the series of links to the pages
# we use a numeric input tag to set the page and the Pagy.compact javascript to navigate
def pagy_plain_compact_nav(pagy, id=caller(1,1)[0].hash)
def pagy_plain_compact_nav(pagy, id=caller(1,1)[0].hash.to_s)
html, link, p_prev, p_next, p_page, p_pages = +'', pagy_link_proc(pagy), pagy.prev, pagy.next, pagy.page, pagy.pages

html << %(<nav id="pagy-nav-#{id}" class="pagy-nav-compact pagy-plain-compact-nav pagination" role="navigation" aria-label="pager">)
Expand All @@ -29,7 +29,7 @@ def pagy_plain_compact_nav(pagy, id=caller(1,1)[0].hash)

# Plain responsive pagination: it returns the html with the series of links to the pages
# rendered by the Pagy.responsive javascript
def pagy_plain_responsive_nav(pagy, id=caller(1,1)[0].hash)
def pagy_plain_responsive_nav(pagy, id=caller(1,1)[0].hash.to_s)
tags, link, p_prev, p_next, responsive = {}, pagy_link_proc(pagy), pagy.prev, pagy.next, pagy.responsive

tags['before'] = (p_prev ? %(<span class="page prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</span> )
Expand Down
4 changes: 2 additions & 2 deletions lib/pagy/extras/semantic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def pagy_semantic_nav(pagy)

# Compact pagination for semantic: it returns the html with the series of links to the pages
# we use a numeric input tag to set the page and the Pagy.compact javascript to navigate
def pagy_semantic_compact_nav(pagy, id=caller(1,1)[0].hash)
def pagy_semantic_compact_nav(pagy, id=caller(1,1)[0].hash.to_s)
html, link, p_prev, p_next, p_page, p_pages = +'', pagy_link_proc(pagy, 'class="item"'), pagy.prev, pagy.next, pagy.page, pagy.pages

html << %(<div id="pagy-nav-#{id}" class="pagy-nav-compact-semantic pagy-semantic-compact-nav ui compact menu" role="navigation" aria-label="pager">)
Expand All @@ -44,7 +44,7 @@ def pagy_semantic_compact_nav(pagy, id=caller(1,1)[0].hash)

# Responsive pagination for semantic: it returns the html with the series of links to the pages
# rendered by the Pagy.responsive javascript
def pagy_semantic_responsive_nav(pagy, id=caller(1,1)[0].hash)
def pagy_semantic_responsive_nav(pagy, id=caller(1,1)[0].hash.to_s)
tags, link, p_prev, p_next, responsive = {}, pagy_link_proc(pagy, 'class="item"'), pagy.prev, pagy.next, pagy.responsive

tags['before'] = (p_prev ? %(#{link.call p_prev, '<i class="left small chevron icon"></i>', 'aria-label="previous"'})
Expand Down
2 changes: 1 addition & 1 deletion lib/pagy/extras/shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def responsive
end

def self.deprecate(mod, old_meth, new_meth)
mod.send(:define_method, old_meth) do |pagy, id=caller(1,1)[0].hash|
mod.send(:define_method, old_meth) do |pagy, id=caller(1,1)[0].hash.to_s|
Warning.warn "WARNING: The ##{old_meth} pagy helper method is deprecated and will be removed in 2.0; please use ##{new_meth} instead. More info at https://github.com/ddnexus/pagy/blob/master/DEPRECATIONS.md\n"
mod.instance_method(new_meth).arity == 1 ? send(new_meth, pagy) : send(new_meth, pagy, id)
end
Expand Down

0 comments on commit 98ce8e7

Please sign in to comment.