Re: Referencing the context path from within Javascript?

2012-01-30 Thread Thiago H. de Paula Figueiredo
On Mon, 30 Jan 2012 11:03:16 -0200, Julien Martin wrote: @Thiago, I actually wanted to avoid an additional dependency. That's ok, but then you're not using a stack. It would have worked if you included it as a library. I've never used tapestry5-jquery myself, but I do think it deserves to

Re: Referencing the context path from within Javascript?

2012-01-30 Thread Julien Martin
@Thiago, I actually wanted to avoid an additional dependency. I am going to include the autocomplete javascript within the root layout as a library. @All Thanks all for helping me with this issue!! I understand how Tapestry deals with javascript much better now!! [?] Regards, Julien. 2012/1/30 T

Re: Referencing the context path from within Javascript?

2012-01-30 Thread Julien Martin
I tried using the "@Import stack=" in order to include the jquery libraries to no avail. I get this: Render queue error in SetupRender[Index:childminderlayout.layout]: No JavaScriptStack with name 'context:/js/jquery-1.6.2.js'. Any one has any clue? Regards, Julien. 2012/1/30 Julien Martin > @Th

Re: Referencing the context path from within Javascript?

2012-01-30 Thread Julien Martin
@Thiago: ok will do. 2012/1/30 Thiago H. de Paula Figueiredo > On Mon, 30 Jan 2012 08:14:40 -0200, Julien Martin > wrote: > > I have actually. The issue is how to replace a variable within the js >> file with the appropriate value. >> > > You don't. Make it a parameter of a function you'll cal

Re: Referencing the context path from within Javascript?

2012-01-30 Thread Julien Martin
You're right François, It is an issue with the inclusion order of my files. I noticed that the files @Import(ed) by my main layout component come after the files @Import(ed) by the pages that use that layout. It should be the other way around. Is there a way to have more control over that? Julien.

Re: Referencing the context path from within Javascript?

2012-01-30 Thread François Facon
This should work. Perhaps a conflict regading inclusion order of your js file. At this point you have to debug with firebug to see why Tapestry.Initializer.bignibou_autocomplete() is not defined. perhaps extend failed as jquery was already there. Regards François ---

Re: Referencing the context path from within Javascript?

2012-01-30 Thread Julien Martin
Hi François, I like your solution as it seems more flexible. I tried to implement it as follows: /js/jquery.autocomplete.js: *jQuery.noConfict();* *(function($) {* * $.extend(Tapestry.Initializer, {* * bignibou_autocomplete : function(specs) {* * $("#accountPostcode").autocomplete({* * source : fu

Re: Referencing the context path from within Javascript?

2012-01-30 Thread Julien Martin
Thanks Lenny, Is the dependency to "com.flowlogix.web.services.AssetMinimizer" necessary? Is there a "pure-T5" way of retrieving the string from the script? Here is what I came up with borrowing from your code: *javaScriptSupport.addScript(getString(openStream(jsAutocomplete)), link);* * * * pri

Re: Referencing the context path from within Javascript?

2012-01-30 Thread François Facon
It would be better to use js object and pass parameter to constructor. for prototype see http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/robust for jquery https://github.com/got5/tapestry5-jquery/blob/master/src/

Re: Referencing the context path from within Javascript?

2012-01-30 Thread Lenny Primak
Take a look at these: http://code.google.com/p/flowlogix/source/browse/tapestry-services/src/main/java/com/flowlogix/web/mixins/ColorHighlight.java http://code.google.com/p/flowlogix/source/browse/tapestry-services/src/main/resources/com/flowlogix/web/mixins/ColorHighlight.js On Jan 30, 2012, at

Re: Referencing the context path from within Javascript?

2012-01-30 Thread Julien Martin
Thanks François, I have actually. The issue is how to replace a variable within the js file with the appropriate value. This seems easy enough with an inline script as above but if the script is located in its own file I don't know how to achieve the desired effect. Regards, Julien. Le 30 janvier

Re: Referencing the context path from within Javascript?

2012-01-30 Thread François Facon
Hi Julien, did you try the use of @Import to import your js file as explained http://tapestry.apache.org/javascript.html? Regards François 2012/1/30 Julien Martin : > Hi Thiago! > > Using your advice, I managed to generate the link easily. I have also moved > the script to a separate file as adv

Re: Referencing the context path from within Javascript?

2012-01-30 Thread Julien Martin
Hi Thiago! Using your advice, I managed to generate the link easily. I have also moved the script to a separate file as advised. Now what remains unclear to me is that the *addScript* method takes a String and not a url to my javascript file. So on the one hand I have my link, on the other my ja

Re: Referencing the context path from within Javascript?

2012-01-29 Thread Thiago H. de Paula Figueiredo
On Sun, 29 Jan 2012 19:22:31 -0200, Julien Martin wrote: Thiago, Hi! Yes it is indeed a Tapestry page. Here is the java code for it (there is no template for this page): So the correct way of generating an URL for a page is to @Inject PageRenderLinkSource and use one of its methods. Th

Re: Referencing the context path from within Javascript?

2012-01-29 Thread Thiago H. de Paula Figueiredo
On Sat, 28 Jan 2012 20:12:06 -0200, Julien Martin wrote: Hello Thiago, Hi! It is on a page template. The advice you provide does work. However, I am realizing I need to concatenate the protocol+host+etc. which is a bit cumbersome. Page templates don't handle anything. Pages, components

Re: Referencing the context path from within Javascript?

2012-01-28 Thread Julien Martin
2012/1/28 Julien Martin > Hello Thiago, > > It is on a page template. The advice you provide does work. However, I am > realizing I need to concatenate the protocol+host+etc. which is a bit > cumbersome. > > The problem I have is that I don't understand how the path is worked out. > My javascript

Re: Referencing the context path from within Javascript?

2012-01-28 Thread Thiago H. de Paula Figueiredo
On Sat, 28 Jan 2012 17:43:17 -0200, Julien Martin wrote: Hello, Hi! How can I achieve this with T5? As a general answer, you can @Inject HttpServletRequest and use its getContextPath() method. Depending on who handles this URL (a Tapestry page? a Tapestry page event handler method), t