Agile Web Development

Build it. Launch it. Love it.

embedded_javascripts

Embedded JavaScripts v.1.0

====================

This plugin help you to integrate your server-side javascripts in your view.

The main problems of webmaster is pass vars to .js files.

The only way wose include your js in the view or put it on partials, but now, with Embedded JavaScripts all is most simple and good to look.

Make a new pure javascript file and give ejs extension and all are done!

Example:

def myview

        @var = "Hello World here"

end

myview.rhtml

        <%= include_javascript "mytest" %>

        Put wath you want here

test.ejs

        alert('<%= @var %>');

Result

                alert('Hello World here');

        Put wath you want here

Simple no????

Please visit http://blog.lipsiasoft.com and give me a good rating!

Vitals

Home http://blog.lipsiasoft.org
Repository http://lipsiasoft.googlecode.com/svn/trunk/embedded_javascripts
License Rails' (MIT)
Tags Tag_red daddye ejs javascript javascripts
Rating (87 votes)
Owner Davide D'Agostino (DAddYE)
Created 25 September 2007

Comments

  • Avatar
    Wolfram Arnold
    9 August 2008

    I find one of the biggest problems with JS code that's server-generated is testing.

    What are your thoughts on this?

Add a comment