how to ask a gsp from a plugin to import js stuff in my own app?

View: New views
4 Messages — Rating Filter:   Alert me  

how to ask a gsp from a plugin to import js stuff in my own app?

by Haotian Sun :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi guys,

I just notice that if I do <g:javascript src="prototype/prototype.js"/>
in a gsp from a plugin, it actually imports the js from the plugin's js dir.

Is there any way that I can import the js from my app's js dir using
<g:javascript> tag?

Cheers

Haotian


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: how to ask a gsp from a plugin to import js stuff in my own app?

by Konstantyn Smirnov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

try with
<g:javascript src="${createLinkTo(dir:'prototype',file:prototype.js')}"/>

Re: how to ask a gsp from a plugin to import js stuff in my own app?

by Haotian Sun :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Konstantyn Smirnov wrote:
> try with
> <g:javascript src="${createLinkTo(dir:'prototype',file:'prototype.js')}"/>
>  
No, not works and it creates the following tag in that way

<script src="/myapp//plugins/searchable-0.4.2-SNAPSHOT/js//myapp/prototype/prototype.js" type="text/javascript">

and if I do this way: <g:javascript src="prototype/prototype.js"/> , it
creats the tag:

<script src="/myapp//plugins/searchable-0.4.2-SNAPSHOT/js/prototype/prototype.js" type="text/javascript">
which is also wrong as it has double slashes in the src path.

I think this is a bug, but have a no idea if it's known or not.

Haotian

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: how to ask a gsp from a plugin to import js stuff in my own app?

by Konstantyn Smirnov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

see http://grails.org/doc/1.0.x/ref/Tags/createLinkTo.html

and try playing with "absolute" attribute:

absolute (optional) - If set to "true" will prefix the link target address with the value of the grails.serverURL property from Config, or http://localhost:<port> if no value in Config and not running in production.