New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add config option for specifying alternate views directory #1026
Comments
We already have a conventional way for organizing the default pagination templates. Have you tried putting the templates in |
No problem. I'm already putting my templates in I'm just suggesting that it would also be nice to have complete control over where kaminari templates are stored within To be clear, in my example above, the templates would be stored in For bigger apps with larger teams, folks may not be familiar with kaminari (as awesome as it is), so it would be nice to store the templates in a directory with a more obvious and generic name that describes their function and that has no connection to the gem itself. Make sense? |
The
That makes sense. It shouldn't be too difficult to do that as it's basically a single line change(see the line below). If we were to allow for changing that, it should probably be only a global option since having these similar options are quite confusing.
Another minor concern is conflict with other pagination gems like |
@mokolabs, @yuki24 no actually in the face of convention over configuration it does not make sense at all. The view templates are in the place they should be given the convention. Any developer using Rails for a bit knows what is inside /app/views and it's not that hard to guess that kaminari templates are in /app/views/kaminari. Making it configurable mandates getting the configured value every time making finding templates slower even if by a tiny amount. For what? A single use-case? Not worth it I think. |
Currently, if you need to specify an alternate directory for Kaminari templates, you must do so by passing an option to the
paginate
helper.While this option does work, it's not especially DRY. Most folks probably need to change templates for their entire application, so adding this option every time you add pagination to a view seems a bit repetitive.
So, to DRY things up, it would be nice if Kaminari supported a config option for the views prefix.
It would also be nice to allow full customization here. So, instead of changing just the parent directory of the kaminari directory with the views prefix, you should be able to change the complete path to your templates.
This could replace
views_prefix
entirely... or they could co-exist if there's still a good reason to keep the prefix in place.The text was updated successfully, but these errors were encountered: