Skip to content

Commit

Permalink
Merge branch 'hotfix-overflow'
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Nov 10, 2021
2 parents bf00c33 + 3d7d3a5 commit 11e8f8a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
GEM=pagy
VERSION=5.2.2
VERSION=5.2.3
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,10 @@ FYI: The `@pagy.items` is now always equal to `@pagy.vars[:items]` (i.e. the req

- Calendar docs improvements and fixes
- Fix for missing defined?(Calendar) checks; small simplification in headers extra

## Version 5.2.3

- Refactoring of rails_inline_input.rb (include and close #342)
- docs: add tutorial, simplify header (#343)
- Fix for overflow :empty_page in regular Pagy instances, not returning an empty page

4 changes: 4 additions & 0 deletions apps/pagy_standalone_app.ru
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ require 'pagy/extras/items'
# Pagy::DEFAULT[:items_extra]
require 'pagy/extras/trim'
Pagy::DEFAULT[:trim_extra] = false # opt-in trim

require 'pagy/extras/overflow'
Pagy::DEFAULT[:overflow] = :empty_page

# require 'pagy/extras/gearbox'
# Pagy::DEFAULT[:gearbox_items] = [10, 20, 40, 80]
Pagy::DEFAULT.freeze
Expand Down
2 changes: 1 addition & 1 deletion lib/config/pagy.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# Pagy initializer file (5.2.2)
# Pagy initializer file (5.2.3)
# Customize only what you really need and notice that Pagy works also without any of the following lines.
# Should you just cherry pick part of this file, please maintain the require-order of the extras

Expand Down
2 changes: 1 addition & 1 deletion lib/javascripts/pagy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Container of the whole pagy stuff
function Pagy(){}

Pagy.version = '5.2.2'
Pagy.version = '5.2.3'

// Used by the waitForMe function
Pagy.delay = 100
Expand Down
2 changes: 1 addition & 1 deletion lib/pagy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Core class
class Pagy
VERSION = '5.2.2'
VERSION = '5.2.3'

# Root pathname to get the path of Pagy files like templates or dictionaries
def self.root
Expand Down
2 changes: 1 addition & 1 deletion lib/pagy/extras/overflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def initialize(vars)
initialize vars.merge!(page: @last) # re-run with the last page
@vars[:page] = requested_page # restore the requested page
when :empty_page
@offset = @in = @from = @to = 0 # vars relative to the actual page
@offset = @items = @from = @to = 0 # vars relative to the actual page
if defined?(Calendar) && is_a?(Calendar) # only for Calendar instances
edge = @order == :asc ? @final : @initial # get the edge of the overflow side (neat, but it would work with any time)
@utc_from = @utc_to = edge.getutc # set both to the edge utc time (a query with >= && < will get no record)
Expand Down
4 changes: 2 additions & 2 deletions test/pagy/extras/overflow_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
pagy = Pagy.new(pagy_vars.merge(overflow: :empty_page))
_(pagy.page).must_equal 100
_(pagy.offset).must_equal 0
_(pagy.items).must_equal 10
_(pagy.in).must_equal 0
_(pagy.items).must_equal 0
_(pagy.in).must_be_nil
_(pagy.from).must_equal 0
_(pagy.to).must_equal 0
_(pagy.prev).must_equal pagy.last
Expand Down

0 comments on commit 11e8f8a

Please sign in to comment.