On Nov 10, 2009, at 4:52 am, Jacques Crocker wrote:
> HAML provides the ability to use interpolation anywhere within the
> javascript literal. For example:
>
> :javascript
> window.addEvent('domready', function(){
> console.log("#...@some_string}");
> });
>
> set @some_string on the controller and you'll be able to get what you
> need.
>
> It's definitely not great for blocks and if/then statements, but it
> should provide for at least a bit of dynamic content within your
> javascript code. I'd recommend against all that though and doing
> things through non-obstrusive methods.
I now have a policy that every page contains only one JS function call (in our
case, dojo.addOnLoad() with an anoymous setup), that uses interpolation to
generate the call. Everything else is handled in plain JS files elsewhere.
This helps avoid the nightmare of figuring out what the interpolation is doing.
It also means all our source can be easily checked with JSLint.
Ashley
--
http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---