You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by trsvax <tr...@gmail.com> on 2013/01/12 15:56:05 UTC
Can't get Tapestry 5.4-alpha-2 jQuery Support to work
I created a project with alpha-2 in my POM and followed the blog post
http://tapestryjava.blogspot.com/2013/01/tapestry-54-jquery-support-now-in-place.html
by adding this to my AppModule
@Contribute(SymbolProvider.class)
@ApplicationDefaults
public static void
contributeApplicationDefaults(MappedConfiguration<String, Object>
configuration) {
configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en");
configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
configuration.add(SymbolConstants.APPLICATION_VERSION,
"0.0.1-SNAPSHOT");
configuration.add(SymbolConstants.HMAC_PASSPHRASE,"test");
configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER,
"jquery");
}
@Contribute(Compatibility.class)
public static void disableScriptaculous(MappedConfiguration<Trait,
Boolean> configuration) {
// not needed with jquery configuration.add(Trait.SCRIPTACULOUS,
false);
configuration.add(Trait.INITIALIZERS, false);
}
Changing the Trait values works as I would expect but no matter what I set
SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER to I still get the
prototype.js and
t5-core-dom-prototype.js (as dom.js). I set a break point and the code
if (provider.equals("prototype"))
{
configuration.add("t5/core/dom", new
JavaScriptModuleConfiguration(domPrototype));
}
if (provider.equals("jquery"))
{
configuration.add("t5/core/dom", new
JavaScriptModuleConfiguration(domJQuery));
}
appears to do the right thing. Is there something I'm missing?
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Can-t-get-Tapestry-5-4-alpha-2-jQuery-Support-to-work-tp5719266.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Can't get Tapestry 5.4-alpha-2 jQuery Support to work
Posted by Serge Eby <sd...@hotmail.com>.
Surprisingly, I don't get Prototype. Are you sure you are using the
"official" 5.4-alpha-2 and not a local build?
FWIW, I have the following in my Layout component (as I use bootstrap):
@Import( stack = { InternalConstants.CORE_STACK_NAME },
stylesheet = {
"${tapestry.bootstrap-root}/css/bootstrap-responsive.css",
"context:styles/style.css",
"context:styles/t5-override.css"},
library = { "context:scripts/lib/plugins/jquery.cookie.js" }
)
public class Layout {
//....
@Inject
private JavaScriptSupport jsSupport;
// ....
void afterRender() {
jsSupport.require("bootstrap");
}
}
My AppModule has a @SubModule(EnableJQueryModule.class) based on the code
you referenced earlier (same as putting them in the AppModule as you did).
This works for me and I don't see any reference to Prototype.
HTH,
/Serge
--
View this message in context: http://tapestry-users.832.n2.nabble.com/Can-t-get-Tapestry-5-4-alpha-2-jQuery-Support-to-work-tp7584477p7584483.html
Sent from the Tapestry Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Can't get Tapestry 5.4-alpha-2 jQuery Support to work
Posted by trsvax <tr...@gmail.com>.
I commented out the line to see if the the "jquery" line was working. The
Scriptaculous Trait only applies for prototype and that's exactly what
happens. If I set
SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER,"jquery"
the Scriptacolous trait does nothing. With
SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER,"prototype"
Scriptaculous is turned on and off.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Can-t-get-Tapestry-5-4-alpha-2-jQuery-Support-to-work-tp5719266p5719269.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Can't get Tapestry 5.4-alpha-2 jQuery Support to work
Posted by Serge Eby <sd...@hotmail.com>.
Hi,
For 5.4-alpha-2, I believe you still need to disable Scriptaculous when
using JQuery (it's fixed in alpha-3).
I see that you commented out this line:
// not needed with jquery configuration.add(Trait.SCRIPTACULOUS,
false);
Is it not working when uncommented?
/Serge
--
View this message in context: http://tapestry-users.832.n2.nabble.com/Can-t-get-Tapestry-5-4-alpha-2-jQuery-Support-to-work-tp7584477p7584479.html
Sent from the Tapestry Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org