On Thu, Feb 21, 2008 at 9:08 AM, gauda <info at gauda.de> wrote:
> hi all!
>
> i like to know if its possible to use masterview with different themes
> per user. the idea is to use one theme per shop like www.shopify.com
> i would like to use masterview in combination with theme_support.
> http://mattmccray.com/svn/rails/plugins/theme_support/README
>
> can masterview handle this? if that is not possible, would it be hard
> to implement such a feature?
>
> i think the point are these configuration options. is it possible to
> change template_src_dir_path and template_src_dir_abs_path at runtime
> for example as a before_filter?
> settings.rb:
> config.template_src_dir_path = ''app/views''
> config.template_src_dir_abs_path(
''/path/to/masterview/templates'' )
>
Gauda,
I just looked at Matt''s plugin and tried to determine what would need
to
change to make these work together.
It looks like essentially that Matt''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''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''t know if there would be any major hurdles in doing that.
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.
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.
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''ll
have /foo/theme1 /foo/theme2 , ...
Set config.template_src_dir_abs_path(''/foo'') # so it points to
the dir above
your themes and will process all of them inside
Set config.template_dst_dir_path(''app/themes'') # so it points
to the dir
above the themes where your rhtml should be output
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="layout/foo.rhtml" might become
mv:generate="theme1/layout/foo.rhtml".
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''s plugin should work fine given the the
rhtml
is all there in the proper structure.
The only issue that might still occur is that the render_partial method
calls might need tweaking depending on whether Matt''s plugin allows the
theme as part of the path or not.
Well hope that helps.
Blessings,
Jeff
config.template_src_dir_abs_path
--
Jeff Barczewski, MasterView core team
Inspired Horizons Ruby on Rails Training and Consultancy
http://inspiredhorizons.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/masterview-users/attachments/20080222/8f444cc4/attachment.html