From 4449c95db2b01ec78974582957462157418fb463 Mon Sep 17 00:00:00 2001 From: Bernie Chiu Date: Tue, 19 Jun 2018 18:50:37 +0200 Subject: [PATCH] normalization of indentation and empty lines --- lib/pagy/extras/responsive.rb | 1 - lib/pagy/frontend.rb | 10 +++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/pagy/extras/responsive.rb b/lib/pagy/extras/responsive.rb index 176cc51b6..6cbf2fdef 100644 --- a/lib/pagy/extras/responsive.rb +++ b/lib/pagy/extras/responsive.rb @@ -50,7 +50,6 @@ def pagy_nav_responsive(pagy, id=caller(1,1)[0].hash) %(#{script}) end - # Responsive pagination for bootstrap: it returns the html with the series of links to the pages # we build the tags as a json object string and render them with the PagyResponsive javascript def pagy_nav_bootstrap_responsive(pagy, id=caller(1,1)[0].hash) diff --git a/lib/pagy/frontend.rb b/lib/pagy/frontend.rb index 81d4c7a27..41442c0de 100644 --- a/lib/pagy/frontend.rb +++ b/lib/pagy/frontend.rb @@ -16,9 +16,9 @@ def pagy_nav(pagy) tags << (p_prev ? %(#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'} ) : %(#{pagy_t('pagy.nav.prev')} )) pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36] - tags << if item.is_a?(Integer); %(#{link.call item} ) # page link - elsif item.is_a?(String) ; %(#{item} ) # current page - elsif item == :gap ; %(#{pagy_t('pagy.nav.gap')} ) # page gap + tags << if item.is_a?(Integer); %(#{link.call item} ) # page link + elsif item.is_a?(String) ; %(#{item} ) # current page + elsif item == :gap ; %(#{pagy_t('pagy.nav.gap')} ) # page gap end end tags << (p_next ? %(#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}) @@ -26,7 +26,6 @@ def pagy_nav(pagy) %() end - # Return examples: "Displaying items 41-60 of 324 in total" or "Displaying Products 41-60 of 324 in total" def pagy_info(pagy) name = pagy_t(pagy.vars[:item_path], count: pagy.count) @@ -34,18 +33,15 @@ def pagy_info(pagy) pagy_t(path, item_name: name, count: pagy.count, from: pagy.from, to: pagy.to) end - # this works with all Rack-based frameworks (Sinatra, Padrino, Rails, ...) def pagy_url_for(page, pagy) p_vars = pagy.vars; params = request.GET.merge(p_vars[:page_param] => page, **p_vars[:params]) "#{request.path}?#{Rack::Utils.build_nested_query(pagy_get_params(params))}#{p_vars[:anchor]}" end - # Sub-method called only by #pagy_url_for: here for easy customization of params by overriding def pagy_get_params(params) params end - MARKER = "-pagy-#{'pagy'.hash}-" # Returns a performance optimized proc to generate the HTML links