[yast-devel] Views custom javascripts and stylesheets
I am writing this now that the testsuite is again in blue state :-) One of the things that prevented the validation to pass was systemtime use of custom javascript. WebYaST has a main layout, which includes the standard javascript file. The plugins views are embedded inside the body of the layout. So how can a view add its custom javascripts and stylesheets? If you just add javascript or link tags, the html will be invalid, and you will breat the build. link tags are not allowed inside a div. They have to be in the head section of the document. "But the head section is in the layout". Yes. Enter the magic :-) http://asciicasts.com/episodes/8-layouts-and-content-for The trick is that the layout does a yield :head in the head section of the layut. The name is arbitrary, but for head that is the convention. Then the view can do in any part: <% content_for :head do %> <% end %> To add stuff to the head section. This trick can also be used to create an API fr the views to add content to menus, and other areas of the layout by defining new "areas", and we should document this in the documentation relative to writing modules. -- Duncan Mac-Vicar P. - Engineering Manager, YaST SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (1)
-
Duncan Mac-Vicar Prett