Uncaught Error: Module build failed (from ./node_modules/rails-erb-loader/index.js):
Error: rails-erb-loader failed with code: 1
hey! how could one add classes directly (inline) to the <%== link.call(item) %>
, or the <%= item %>
?
I'm using Tailwind and would like to keep utilities inline, and I want to style the link directly to make the click area bigger (using padding).
I was able to add classes to previous and next buttons as follows: <%== link.call(pagy.prev, "‹ Previous", 'class="p-4 ... "' %>
, but I can't do the same with link.call(item)
.
Everything I write after item, for example: link.call(item, 'class="p-4"')
is rendered directly on the page... Would appreciate your help. Thank you!
def pagy_bootstrap_nav_js(pagy, id=pagy_id)
link, p_prev, p_next = pagy_link_proc(pagy, 'class="page-link"'), pagy.prev, pagy.next
tags = { 'before' => p_prev ? %(<ul class="pagination"><li class="page-item prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</li>)
: %(<ul class="pagination"><li class="page-item prev disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.prev')}</a></li>),
'link' => %(<li class="page-item">#{mark = link.call(PAGE_PLACEHOLDER)}</li>),
'active' => %(<li class="page-item active">#{mark}</li>),
'gap' => %(<li class="page-item gap disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.gap')}</a></li>),
'after' => p_next ? %(<li class="page-item next">#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}</li></ul>)
: %(<li class="page-item next disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.next')}</a></li></ul>) }
%(<nav id="#{id}" class="pagy-bootstrap-nav-js" role="navigation" aria-label="pager"></nav>#{pagy_json_tag(:nav, id, tags, pagy.sequels, defined?(TRIM) && pagy.vars[:page_param])})
end
checked the source code. Do i need to override this method?
Hello everyone!
I'm building a watchlist app on rails, using Tmdb API.
Basically I'd like to search for movies, and have the results displaying 20 movies per page.
I'm also using the 'themoviedb-api' gem, which allows me to use the following in my controller (for exemple for Harry potter)
Tmdb::Search.movie("Harry Potter")
which will give back :
#<Tmdb::Result page=1, total_pages=23, total_results=446, results=[#<Tmdb::Movie adult=false, backdrop_path="/hziiv14OpD73u9gAak4XDDfBKa2.jpg", genre_ids=[12, 14], id=671, original_language="en", original_title="Harry Potter and the Philosopher's Stone", overview="Harry Potter has lived under the stairs at his aunt and uncle's house his whole life. But on his 11th birthday, he learns he's a powerful wizard -- with a place waiting for him at the Hogwarts School of Witchcraft and Wizardry. As he learns to harness his newfound powers with the help of the school's kindly headmaster, Harry uncovers the truth about his parents' deaths -- and about the villain who's to blame.", popularity=144.218, poster_path="/wuMc08IPKEatf9rnMNXvIDxqP4W.jpg", release_date="2001-11-16", title="Harry Potter and the Philosopher's Stone", video=false, vote_average=7.9, vote_count=19723>
So there are already the page, total_pages in the API answer, but I don't know how to exploit them.
I tried to do
@pagy, @movies = pagy(Tmdb::Search.movie(params[:query]))
But it seems to suits only for model saved in DB. In my case the Movies are API calls
Thanks
pagy
constructor does
I've tried it but it seems that @movies still shows the result array of the first page, no matter which page i'm accessing.
I also tried to use the Array Extra, by doing to following in my controller:
movies = Tmdb::Search.movie(params[:query])
@pagy_a, @movies = pagy_array(movies.results, count: movies.total_results, page: movies.page)
But the same is happening, always showing me the first page array
Tmdb::Search.movie(params[:query], page: params[:page])
page
< 1. I'd like it to return an empty page as well
rescue_from ArgumentError
be aware of the gotcha at the end of the page.