On Thu, Feb 21, 2008 at 9:08 AM, gauda &lt;<a href="mailto:info@gauda.de">info@gauda.de</a>&gt; wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
hi all!<br>
<br>
i like to know if its possible to use masterview with different themes<br>
per user. the idea is to use one theme per shop like <a href="http://www.shopify.com" target="_blank">www.shopify.com</a><br>
i would like to use masterview in combination with theme_support.<br>
<a href="http://mattmccray.com/svn/rails/plugins/theme_support/README" target="_blank">http://mattmccray.com/svn/rails/plugins/theme_support/README</a><br>
<br>
can masterview handle this? if that is not possible, would it be hard<br>
to implement such a feature?<br>
<br>
i think the point are these configuration options. is it possible to<br>
change template_src_dir_path and template_src_dir_abs_path at runtime<br>
for example as a before_filter?<br>
settings.rb:<br>
config.template_src_dir_path = &#39;app/views&#39;<br>
config.template_src_dir_abs_path( &#39;/path/to/masterview/templates&#39; )<br>
<font color="#888888"></font></blockquote><div><br></div></div><br>Gauda,<br><br>I just looked at Matt&#39;s plugin and tried to determine what would need to change to make these work together. <br><br>It looks like essentially that Matt&#39;s plugin allows one to have the equivalent of multiple roots (as far as layouts and views are concerned) and this factor would require a bit of changing to make MasterView take advantage of it. We&#39;d probably have to loop over all of the themes changing the template_src_dir_path and template_dst_dir_path like you mentioned and I don&#39;t know if there would be any major hurdles in doing that.<br>
<br>However one way that should work just fine is to put your MasterView templates without any major surgery is to make MasterView generate the rhtml files to disk and set things up so they will end up going into the structure Matt needs at runtime. <br>
<br>You would tell MasterView to always generate rhtml files to disk (for all run modes) using config.generate_rhtml_files = true in your main masterview settings.rb file.<br><br>To keep things clear I would create a new directory somewhere which will be the root of all your themed MasterView templates /foo. Inside here you&#39;ll have /foo/theme1 /foo/theme2 , ...<br>
<br>Set config.template_src_dir_abs_path(&#39;/foo&#39;) # so it points to the dir above your themes and will process all of them inside<br><br>Set config.template_dst_dir_path(&#39;app/themes&#39;) # so it points to the dir above the themes where your rhtml should be output<br>
<br>Then you simply need to have your mv:generate, mv:gen_partial, mv:import, mv:import_partial filepaths all specify the theme as well as the rest of the filename, so mv:generate=&quot;layout/foo.rhtml&quot; might become mv:generate=&quot;theme1/layout/foo.rhtml&quot;. <br>
<br>MasterView will then generate the rhtml into the structure you need for the plugin. And by setting generate_rhtml_files = true, effectively you can run without MasterView at all at that point since all the necessary rhtml is already on the disk, so Matt&#39;s plugin should work fine given the the rhtml is all there in the proper structure.<br>
<br>The only issue that might still occur is that the render_partial method calls might need tweaking depending on whether Matt&#39;s plugin allows the theme as part of the path or not. <br><br>Well hope that helps. <br><br>
Blessings,<br><br>Jeff<br><br><br><code>config.template_src_dir_abs_path = </code><br><br><br>-- <br>Jeff Barczewski, MasterView core team<br>Inspired Horizons Ruby on Rails Training and Consultancy<br><a href="http://inspiredhorizons.com/">http://inspiredhorizons.com/</a>