Giter Club home page Giter Club logo

Comments (13)

stevenchanin avatar stevenchanin commented on August 25, 2024 4

For people using HAML, the shortcut for html_safe is !=:

!= pagy_nav(@pagy)

from pagy.

dwieringa avatar dwieringa commented on August 25, 2024 1

First, I'd like to mention I have been impressed with the amount and polish of the documentation. It speaks a lot to the care for the gem.

I, however, ended up finding this issue trying to figure out why I was having HTML tags show up on my index page instead of the nav bar.

I'm using slim, and my issue went away when I changed = pagy_nav(@pagy) to = pagy_nav(@pagy).html_safe as grosser recommends in his example. [Quick Start suggests <%== pagy_nav(@pagy) %>]

Even when I switch my view from slim to erb, I still see the same issue.

I'm newer to Ruby and Rails. Did I do something wrong? I'm guessing more detail should be added to the Quick Start? (or some bug fixed?).

from pagy.

grosser avatar grosser commented on August 25, 2024 1

from pagy.

ddnexus avatar ddnexus commented on August 25, 2024

Right! Will do! Thanks.

from pagy.

ddnexus avatar ddnexus commented on August 25, 2024

Hey! I just remembered that I did that long ago :).

What about this Quick Start. Does that count as an example or it is just "all talk"?

from pagy.

ddnexus avatar ddnexus commented on August 25, 2024

@grosser closing this. Please, reopen if needed.

from pagy.

grosser avatar grosser commented on August 25, 2024

The example I posted is as long as the easy to use section and shows all the basics, so I'd prefer that.
Atm people that come in and copy-paste things get 2 undefined method errors and then escaped html, also they need to figure out how to set the page-size, which afaik most users will need.

from pagy.

ddnexus avatar ddnexus commented on August 25, 2024

Atm people that come in and copy-paste things get 2 undefined method errors and then escaped html

Not sure to understand what you say: html copy and paste works from the browser without picking any html char, what are the 2 undefined method error?

Page size will be moved right after the example, so it will read as part of the same thing Thanks for that.

from pagy.

dwieringa avatar dwieringa commented on August 25, 2024

Ah, wait, I see now that I'm short a =. Switching from = pagy_nav(@pagy) (slim) to == pagy_nav(@pagy) resolves my issue. I see now that the Quick Start shows 2 ='s. I mistakenly removed one when I ported to slim.

from pagy.

ddnexus avatar ddnexus commented on August 25, 2024

@dwieringa yes, that is the template equivalent of html_safe

from pagy.

aaronbrethorst avatar aaronbrethorst commented on August 25, 2024

I had figured that the == was a typo in the docs. It'd be helpful to know that was intentional and functionally identical to .html_safe. Great gem, thanks for your hard work.

from pagy.

ddnexus avatar ddnexus commented on August 25, 2024

@aaronbrethorst Yes, that's something long due (also suggested by others) that I always forgot to add. Will do.

BTW, while the <%== or equivalent is embedded in the template system and is agnostic to the type of app you use, the html_safe is a specific ActiveSupport method, hence is not agnostic and not so consistent with pagy.

from pagy.

aaronbrethorst avatar aaronbrethorst commented on August 25, 2024

@ddnexus got it. thanks again!

from pagy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.