Reza Primardiansyah
2007-Jan-03 02:48 UTC
[Masterview-users] how to share header / layout across controllers
Hi, all Can anyone show me how to create shared layout across controller so I can use one design that I can put links to other controllers? Thanks in advance __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Jeff Barczewski
2007-Jan-03 15:55 UTC
[Masterview-users] how to share header / layout across controllers
If you want to use the same layout across all controllers then you edit the list.html template (or which ever master template which contains the mv:generate="layouts/yourcontroller.rhtml") and you will edit this to be instead mv:generate="layouts/application.rhtml". There would only be one of these across all of your MasterView template files, all others would use import. In all your other templates you would use mv:import="layouts/yourcontroller.rhtml" If you had a layouts/appliction.rhtml previously on the file system then delete or rename it so there is no confusion as to which one is being used. You would probably want to rebuild your templates so they are all in sync using the new layout, you do this at the command line with rake mv:rebuild_all or you can do it from the MasterView admin screen (if in development mode on localhost and it hasn''t been disabled in your settings) http://localhost:3000/masterview and click on the Rebuild All link If you wanted to use something other than applicion.rhtml then you would also have to specify the layout in your controller with the layout command, but since in the above we are using appliction.rhtml there is nothing else necessary in the code. See if all this makes sense and works for you. We should add this to a FAQ, I''ll make a note to do this. If you have any problems with everything I described let me know. Blessings, Jeff On 1/2/07, Reza Primardiansyah <reza_prima77 at yahoo.com> wrote:> > Hi, all > > Can anyone show me how to create shared layout across > controller so I can use one design that I can put > links to other controllers? > > Thanks in advance >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-users/attachments/20070103/aedc77f7/attachment-0001.html
Reza Primardiansyah
2007-Jan-08 02:45 UTC
[Masterview-users] how to share header / layout across controllers
Thanks Jeff. Work nicely. But must be noted that script/server must be restarted for the change to appear. --- Jeff Barczewski <jeff.barczewski at gmail.com> wrote:> If you want to use the same layout across all > controllers then you edit the > list.html template (or which ever master template > which contains the > mv:generate="layouts/yourcontroller.rhtml") and you > will edit this to be > instead mv:generate="layouts/application.rhtml". > There would only be one of > these across all of your MasterView template files, > all others would use > import. > > In all your other templates you would use > mv:import="layouts/yourcontroller.rhtml" > > If you had a layouts/appliction.rhtml previously on > the file system then > delete or rename it so there is no confusion as to > which one is being used. > > You would probably want to rebuild your templates so > they are all in sync > using the new layout, you do this at the command > line with > > rake mv:rebuild_all > > or > > you can do it from the MasterView admin screen (if > in development mode > on localhost > and it hasn''t been disabled in your settings) > > http://localhost:3000/masterview > and click on the Rebuild All link > > > If you wanted to use something other than > applicion.rhtml then you would > also have to specify the layout in your controller > with the layout command, > but since in the above we are using appliction.rhtml > there is nothing else > necessary in the code. > > See if all this makes sense and works for you. We > should add this to a FAQ, > I''ll make a note to do this. > > If you have any problems with everything I described > let me know. > > Blessings, > > Jeff > > > > On 1/2/07, Reza Primardiansyah > <reza_prima77 at yahoo.com> wrote: > > > > Hi, all > > > > Can anyone show me how to create shared layout > across > > controller so I can use one design that I can put > > links to other controllers? > > > > Thanks in advance > > > > _______________________________________________ > Masterview-users mailing list > Masterview-users at rubyforge.org >http://rubyforge.org/mailman/listinfo/masterview-users __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Ed Howland
2007-Jan-08 16:52 UTC
[Masterview-users] how to share header / layout across controllers
On 1/7/07, Reza Primardiansyah <reza_prima77 at yahoo.com> wrote:> Thanks Jeff. Work nicely. But must be noted that > script/server must be restarted for the change to > appear. > > > --- Jeff Barczewski <jeff.barczewski at gmail.com> wrote: > > > If you want to use the same layout across all > > controllers then you edit the > > list.html template (or which ever master template > > which contains the > > mv:generate="layouts/yourcontroller.rhtml") and you > > will edit this to be > > instead mv:generate="layouts/application.rhtml". > > There would only be one of > > these across all of your MasterView template files, > > all others would use > > import. > > > > In all your other templates you would use > > mv:import="layouts/yourcontroller.rhtml" > >Just a small notation about the documentation on the MV site. It says to use @content_for_layout in the mv:replace (or mv:content sometimes.) The Rails API says this is deprecated in favor of yield. I''ve tested this with yield and the change is painless so far. Basically, it seems they are eliminating the @content_for subsystem. I guess to speed up rendering. Ed -- Ed Howland http://greenprogrammer.blogspot.com
Jeff Barczewski
2007-Jan-08 22:18 UTC
[Masterview-users] how to share header / layout across controllers
On 1/8/07, Ed Howland <ed.howland at gmail.com> wrote:> > > Just a small notation about the documentation on the MV site. It says > to use @content_for_layout in the mv:replace (or mv:content > sometimes.) The Rails API says this is deprecated in favor of yield. > I''ve tested this with yield and the change is painless so far. > > Basically, it seems they are eliminating the @content_for subsystem. I > guess to speed up rendering. > >Yes, you are correct Ed. Yield is the recommended way to do things now. We''ll plan on updating the docs and the generator accordingly. Thanks for mentioning it. Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-users/attachments/20070108/58ecd967/attachment.html