by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jul 08 15:30
    ddnexus commented #250
  • Jul 08 15:28

    ddnexus on dev

    Add translation for Portuguese … (compare)

  • Jul 08 15:22

    ddnexus on dev

    (compare)

  • Jul 08 15:18

    ddnexus on revert-250-patch-1

    Revert "Add Portuguese translat… (compare)

  • Jul 08 15:17

    ddnexus on dev

    Add translation for Portuguese Add translation for Portuguese … (compare)

  • Jul 08 15:17
    ddnexus closed #250
  • Jul 08 15:15
    ddnexus edited #250
  • Jul 08 14:46
    tiagotex opened #250
  • Jul 02 13:52

    dependabot[bot] on bundler

    (compare)

  • Jul 02 13:52
    dependabot[bot] closed #246
  • Jul 02 13:52
    dependabot[bot] edited #246
  • Jul 02 13:52
    dependabot[bot] commented #246
  • Jul 02 13:52

    ddnexus on acceptance-tests

    prepared infrastructure (compare)

  • Jul 02 13:52
    dependabot[bot] edited #246
  • Jul 02 13:52

    ddnexus on dev

    Adds parentheses (#249) [ci-ski… Merge branch 'dev' (compare)

  • Jul 02 13:51

    ddnexus on master

    fix for extra "-js" in "pagy-co… added "Customizing CSS styles" … added tailwind extra styles and 3 more (compare)

  • Jul 02 13:01
    ddnexus commented #249
  • Jul 02 12:59

    ddnexus on master

    Adds parentheses (#249) [ci-ski… (compare)

  • Jul 02 12:59
    ddnexus closed #248
  • Jul 01 18:59
    codecov[bot] commented #249
Kovacs Nicolas
@nicovak
Hi @ddnexus thanks for the gem, is there a way to make it works within a rails engine ?
Kovacs Nicolas
@nicovak
Oh nevermind I just made It work by including "helper Pagy::Frontend" in my engine base controller ;)
Nilanga saluwadana
@vusaalab
Hi! any guide for pagy with Vue js
Domizio Demichelis
@ddnexus
@nicovak sorry for the delay... sometimes I don't receive any notification from Gitter... good that you find it out.
@vusaalab you may want to look at the metadata extra
Stas Syritsyn
@staleo
Hi all! I use pagy for posts with infinite scroll, all looking good and nifty! However, my new posts are dynamically appearing on the top of the list (thru ActionCable). Therefore, a pagination always "floats" which make some of the posts duplicating upon scrolling up and down. How would you solve this? Thx!
Himanshu
@himanshu-changwal-roostify
I'll ask it in a different way,
Say im on users show page :/users/1 and every user has comments associated to it.
So on :/users/1 show page, i want to add pagination for :/comments index action. I am able to add that but when i click on a page nav say 2, then page gets reloaded.
Domizio Demichelis
@ddnexus
@himanshu-changwal-roostify if "page gets reloaded" means that you would like to ajax load the comments, then you need to setup javascript and data-remote true
Pasindu Madubashan Gunarathne
@mpasindu
I am having an issue when doing some post method call. pagy navigation always requesting GET I want to make POST calls. How can I do this ?
Domizio Demichelis
@ddnexus
A possible solution for post links
kobione
@kobione
This is really cool
JanCherlet
@JanCherlet
I had a problem in my Rails-app: Pagy worked super on my local machine , however, in production there was something wrong. After precompiling the asset pipeline on my local computer, I was able to reproduce the problem. This was solved by changing the line 'window.addEventListener("turbolinks:load", Pagy.init);' to a javascript - function:
window.addEventListener("turbolinks:load", function(){
Pagy.init;
}); and all problems solved. Might be interesting to know.
Domizio Demichelis
@ddnexus
Indeed it is interesting... and weird. Pagy.init returns a function... wrapping it in another function results in a function returning a function
Benjamin Bock
@bb

Hi there! I was looking for a way to customize the maximum gap size in a series. E.g. I have [1, 2, "3", 4, 5, 6, 7, :gap, 100], so there's a giant gap.
Approach 1: define maximum gap size e.g. 50, so I'd like to get e.g. [1, 2, "3", 4, 5, 6, 7, :gap, 53, :gap, 100]
Approach 2: define a fixed number of splits, e.g. 1, so each gap is split into 2 gaps [:gap, 53 , :gap] or 2: [:gap, 38, :gap, 69, :gap]

Is something similar like that already available?

Domizio Demichelis
@ddnexus
That's kind of weird request... :) The pagination deals with a potentially very long series of pages... that you cannot display completely, hence you basically display 3 sub-series: one at the start of the series, one around the current page, and one at the end df the series. Displaying an arbitrary number of sub-series is indeed... arbitrary, so it may be the subject of a very custom UI.
If you want a system that allows the user to navigate easily in any part of the series, then you may want to use something like the combo nav, that accepts an arbitrary input from the user to jump to any page.
I wanted to write a nice slider nav, but I never got the time to do it, and I will probably never get it.
Benjamin Bock
@bb
I was afraid to get this answer. The customer request was based on a SEO recommendation which complained the pages in the middle of the gap are only reachable through many, many clicks.
I proposed to add some editorial links but got the request to have more steps in the pagination.
Either way, I think it won’t improve SEO but rather game the SEO tool 😉
Luka
@Sensanaty

Hey guys, looking to implement pagy into an API I'm building, but I can't seem to get it to work.

I've got a Part model with this index action:

  def index
    @pagy, @parts = Part.all
    pagy_headers_merge(@pagy)

    render json: { parts: @parts }
  end

Nothing complicated or fancy as you can see. Fetching @parts on it's own works fine and returns me all 5000 items that I made in my seed.rb, however if I try call the API with pagy present I get a 500 with the following:

"exception": "#<NoMethodError: undefined method 'prev' for #<Part:0x00005621c5066958>>"

I have the include Page::Backend line in my ApplicationController, and the pagy/extras/headers option has been enabled. And yes, I've restarted the server lol

Using the after_action hook specified in the Docs doesn't make a difference, either.

Also as a quick aside if it makes a difference, I generated my API using the following guide since I'm relatively new to Rails: https://www.pluralsight.com/guides/token-based-authentication-with-ruby-on-rails-5-api

What am I doing wrong? Any help would be much appreciated!

Domizio Demichelis
@ddnexus
@bb I feel your pain :). You can override the series and get as many segments and gaps as you need. The helpers/templates should work as usual even with multiple segments and gaps since they are content type dependent (integer/string/symbol)
@Sensanaty It looks like you are missing paginating the whole collection:
@pagy, @parts = pagy(Part.all)
Luka
@Sensanaty

@ddnexus Oh man, gotta love when you miss such simple, tiny little things even after looking at it for two hours...

Thanks for the help!

Domizio Demichelis
@ddnexus
@bb here is a suggestion for the series with midpoint problem: ddnexus/pagy#245
Benjamin Bock
@bb
@ddnexus thanks! What a coincidence that dizzyfingers wanted the same feature this week. I wonder if they read it here or if some SEO tools added this recommendation recently or how that happened.
Domizio Demichelis
@ddnexus
Yeah... I was wondering if you were the same persons or co-workers working on the same problem :)
Benjamin Bock
@bb
No, we’re not the same nor working together. I stalked his profile and didn’t find any connection at all. My GitHub handle is @bb.
Benjamin Bock
@bb
@ddnexus I just posted the solution I went for on ddnexus/pagy#245. From my perspective, the ticket can be closed. Thanks for your support!
Domizio Demichelis
@ddnexus
I linked the ticket in the "How To" documentation page for future references. Thank you for your input.
Maphumulo
@Siyanda
I was wondering if there is a simple way of displaying the pagination status for example "Showing 6 of 103 Items " I'm currently using the params and a model total count to achieve this but don't really like my solution.
Benjamin Bock
@bb
@Siyanda have you tried pagy_info (see https://ddnexus.github.io/pagy/api/frontend)
Maphumulo
@Siyanda
Thank you so much @bb , this is exactly what I was looking for 🙂. I've just migrated from Kaminari and I'm still getting familiar with Pagy's Frontend, Backend concept
Benjamin Bock
@bb
you're welcome
Marc Köhlbrugge
@marckohlbrugge_twitter
hi all 👋
Is there a way for pagy to start on "page 0" ? – Meaning that it returns no records, but it does have a next page link for page 1?
if I set the page parameter to 0, I get an error message stating that the page should be 1+
Domizio Demichelis
@ddnexus
@marckohlbrugge_twitter pagy is for paginating collections... so let's say you have one with a certain number of items in it, but you don't want to display any item. That means that you don't need pagy at all for that case (i.e. what you call "page 0").
Think as "page 0" means "no pagy". Then you need to skip querying and displaying a pagination bar in that situation. You can do that with an appropriate condition in your controller.
that if you want to go with the same action... but it might be more appropriate just being a different one
For the "next" link... it actually means "show the paginated collection"... so it will be a simple link to the usual business of actually showing the collection with a pagination bar.
Marc Köhlbrugge
@marckohlbrugge_twitter
@ddnexus Thanks, that makes sense. 👍
Long Nguyen
@longnt80
I tried <%== pagy_info(@pagy, 'Widgets'.pluralize(@pagy.count) %> and got this error:
wrong number of arguments (given 2, expected 1)
any idea?
Domizio Demichelis
@ddnexus
@longnt80 it looks like you have to ensure you are using the version >= 3.8.2
Long Nguyen
@longnt80
oh thanks @ddnexus
Fahad
@fahadgudu
Hello friends.
I need to use the infinite scroll in the children div; I tried to implement but it is not working with supplied javascript