Mailinglist Archive: yast-devel (246 mails)

< Previous Next >
[yast-devel] Views custom javascripts and stylesheets
  • From: "Duncan Mac-Vicar Prett" <dmacvicar@xxxxxxx>
  • Date: Thu, 13 Aug 2009 15:51:32 +0200
  • Message-id: <200908131551.32237.dmacvicar@xxxxxxx>

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 :-)

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@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages