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

multistore aware rendering #6

Open
nwb opened this issue Sep 22, 2010 · 0 comments
Open

multistore aware rendering #6

nwb opened this issue Sep 22, 2010 · 0 comments

Comments

@nwb
Copy link

nwb commented Sep 22, 2010

writing views when you have multiple domains can be tricky when you know what is going to be custom to which domain but if you don't really know then either your code is fragile or the site maintainer has to do a lot of customization.

If the way that views/layouts/partials is determined could be tied to the store, it would be a lot easier, you could simply write your code the same way you would if there were only one store.

I think the solution lies in intercepting the creation of the ActionView::LookupContext and passing it an object that ActionView::LookupContext::ViewPaths can use to find the right file.

Then its "just" a matter of deciding how to identify the right file. It could work to prefix file names (_mystore_products.html.erb) but I feel this makes it difficult to identify store specific files (particularly if the store name is similar to a normal file name). Simply having a folder for each store plus one called "core" and one called "required". The files would be looked up first in the require directory (this way you could define things that cannot be store specific like "part of my super kewel network"), then the store directory, then the core directory and finally the the common rails directory.

Another approach would be to have named extensions - theme_required, theme_mystore, theme_core and go from there. The advantage here is that you could make a further enhancement that removed the requirement of having a store specific theme. Instead you could have theme_bluesteel and theme_magnum and the store would define which to use. This might necessitate adding a themes directory to the vendors directory for simplicity.

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

0 participants