Skip to content
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

Adding criteria to find_model_templates #43

Closed
asecondwill opened this issue Jul 24, 2020 · 2 comments
Closed

Adding criteria to find_model_templates #43

asecondwill opened this issue Jul 24, 2020 · 2 comments

Comments

@asecondwill
Copy link

Is there a workflow to add criteria to the finder for templates, for example having different templates per user?

For that, I suppose we would have to somehow pass the @current_user to the finder in the controller, and for that to hook into panoramic.

@andreapavoni
Copy link
Owner

Hi there,

once you have a setup for the model to store store views, you might want to use the path field and, for example, store the user id of a specific view. Then you might use prepend_view_path TemplateStorage.resolver(:only => current_user.id) to search in virtual paths which have the user id prefix.

If you check the source code of this gem and/or check how rails templating works, you might find better solutions. Unfortunately, I'm not using rails since years, I'm just maintaining this gem to keep it working with newer versions of rails.

@asecondwill
Copy link
Author

OK, thanks for your comments. There is also the "additional_criteria" that can be added per render, although that seems like I'd have to add it to every render call on the site, which is a bit clunky. Your idea seems better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants