Comments (12)
@dkabistan frontend or backend?
from refinerycms-page-images.
@parndt This would be on the front-end, currently I'm displaying 20 images on the front-end without pagination(long scroll). Any ideas as to how to paginate, after roughly 5 images?
from refinerycms-page-images.
This extension purposefully stays out of the frontend code so I'm afraid this is up to you. I would suggest using a pagination plugin like will_paginate
as refinerycms-core
already depends on it.
from refinerycms-page-images.
@parndt Does that mean that I can't override the pages-images controller to add paginate with limit amount. If so please advise naming, since I've exhausted finding it.
from refinerycms-page-images.
@dkabistan there is no page-images controller.. All this extension really does is add an images
relationship to refinerycms-pages
and also a backend UI for managing that relationship inside the page's form.
So, on the frontend, you can refer to it using @page.images
(assuming you have a @page
variable.. which you usually will)
How are you currently using this extension on the frontend?
from refinerycms-page-images.
@parndt following the same implementation as refinerycms-page-images
except using a custom view template. I was not aware of it being this simple. I'll try out using will_paginate
.
Thanks !
from refinerycms-page-images.
@dkabistan no problem.. if you have any trouble, feel free to post again to here. I just closed the issue as it's not an "issue" with the extension but am happy to help if I can.
from refinerycms-page-images.
@parndt I followed the wiki to initiate pagination for @page.images
on the front-end, the pagination works but the per_page
limit set is not picked up. Any ideas?
<%= render '/refinery/content_page' %>
<section id="box">
<article class="content">
<% @page.images.each_with_index do |image, index| %>
<figure class="press-item">
<%= link_to image_tag(image.thumbnail(geometry: '242x316').url),
image.thumbnail(geometry: '900x600').url,
class: 'fancybox',
rel: 'gallery'
%>
<figcaption><%= raw @page.caption_for_image_index(index) %></figcaption>
</figure>
<% end %>
</article>
<%= will_paginate @page.images.paginate :page => params[:page], :per_page => 5 %>
</section>
from refinerycms-page-images.
@dkabistan given you're calling a will_paginate
helper it should be working like this, according to the docs.
You could try adding brackets?
<%= will_paginate @page.images.paginate(:page => params[:page], :per_page => 5)
from refinerycms-page-images.
Turns out I needed to define paginate usage on an array(d'oh): Stackoverflow Thread
will_paginate 3.0 is designed to take advantage of the new ActiveRecord::Relation in Rails 3, so it defines paginate only on relations by default. It can still work with an array, but you have to tell rails to require that part.
In a file in your
config/initializers/will_paginate_extension.rb
, add this
require 'will_paginate/array'
Then you can use on arrays
my_array.paginate(:page => params[:page], :per_page => y)
from refinerycms-page-images.
@dkabistan woohoo 👍
from refinerycms-page-images.
@parndt I'm having a bit of an issue figuring this one out. I have successfully paginated my images on the front-end but for some reason my captions are not in sync when you click on the next page.
I've tried adding paginate to @page.caption_for_image_index(index)
but unsuccessfully. Any ideas how to go about?
from refinerycms-page-images.
Related Issues (20)
- Friendly_id version HOT 3
- Unable to install and activesupport error HOT 6
- No documentation available for integration with refinerycms-blog HOT 3
- Installing latest refinerycms-page-images for refinerycms edge HOT 1
- Could not find gem 'refinerycms-page-images (~> 3.0.0) x86-mingw32'
- Could not find gem 'refinerycms-page-images (~> 3.0.0) x86-mingw32' HOT 1
- Images tab state after validation fail HOT 2
- Unknown attribute error when saving pages HOT 9
- NoMethodError: private method `prepend' HOT 3
- unknown attribute 'images_attributes' for Refinery::Page if only added to extension HOT 2
- Tab name not translated HOT 1
- Slow page loading times HOT 1
- Heroku pre-compiling assets fails after Heroku deprecated user-env-compile HOT 5
- refinerycms-page-images HOT 2
- Unable to use Rails 5.2.0 because of version globalize and activerecord HOT 5
- Dependabot can't resolve your Ruby dependency files
- Dependabot can't resolve your Ruby dependency files
- Dependabot can't resolve your Ruby dependency files
- Dependabot can't resolve your Ruby dependency files
- Struggling to invalidate cached single image caption HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from refinerycms-page-images.