Skip to content

Commit

Permalink
New Pagy
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanxu committed Jul 26, 2024
1 parent 926bfe9 commit e204007
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ GEM
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http (1.0.2)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
Expand Down Expand Up @@ -286,7 +286,7 @@ GEM
omniauth (~> 2.0)
openssl (3.2.0)
os (1.1.4)
pagy (8.6.3)
pagy (9.0.2)
pdf-reader (2.11.0)
Ascii85 (~> 1.0)
afm (~> 0.2.1)
Expand All @@ -302,7 +302,7 @@ GEM
pry (>= 0.13, < 0.15)
psych (5.1.2)
stringio
public_suffix (6.0.0)
public_suffix (6.0.1)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.8.0)
Expand Down Expand Up @@ -404,7 +404,7 @@ GEM
searchkick (5.3.1)
activemodel (>= 6.1)
hashie
selenium-webdriver (4.22.0)
selenium-webdriver (4.23.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
Expand Down Expand Up @@ -438,7 +438,7 @@ GEM
trailblazer-option (0.1.2)
ttfunk (1.8.0)
bigdecimal (~> 3.1)
turbo-rails (2.0.5)
turbo-rails (2.0.6)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/invitations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class InvitationsController < ApplicationController
def index
invitations_scope = @track.present? ? Invitation.by_track(@track.id) : Invitation

@pagy, @invitations = pagy(invitations_scope.includes(:editor, :paper).order(created_at: :desc), items: 25)
@pagy, @invitations = pagy(invitations_scope.includes(:editor, :paper).order(created_at: :desc), limit: 25)
end

def expire
Expand Down
5 changes: 1 addition & 4 deletions config/initializers/pagy.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# frozen_string_literal: true

# Default page size
Pagy::DEFAULT[:items] = 20

# No page links
Pagy::DEFAULT[:size] = []
Pagy::DEFAULT[:limit] = 20

require 'pagy/extras/overflow'
Pagy::DEFAULT[:overflow] = :empty_page
Expand Down
2 changes: 1 addition & 1 deletion spec/views/papers/recent.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
create(:accepted_paper, submitting_author: user)
end

assign(:pagy, Pagy.new({count: Paper.all.count, page: 1}))
assign(:pagy, Pagy.new(count: Paper.all.count, page: 1))
assign(:papers, Paper.all)

render template: "papers/index", formats: :html
Expand Down
2 changes: 1 addition & 1 deletion spec/views/papers/submitted.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

create(:paper, state: "submitted", submitting_author: user)

assign(:pagy, Pagy.new({count: Paper.submitted.count, page: 1}))
assign(:pagy, Pagy.new(count: Paper.submitted.count, page: 1))
assign(:papers, Paper.submitted)

render template: "papers/index", formats: :html
Expand Down

0 comments on commit e204007

Please sign in to comment.