To get jQuery as the JS library for monorail I need to do the following:
1. Get the JS files from jQuery and jQuery.Validation, save those to /Content/Js/ (or where ever).
2. Implement the IMonoRailContainerEvents and IMonoRailConfigurationEvents interfaces on my GlobalApplication.cs file.
3. In the Initialized method add:
IAjaxProxyGenerator ajaxProxyGenerator = new JQueryAjaxProxyGenerator();
container.ServiceInitializer.Initialize(ajaxProxyGenerator, container);
container.AjaxProxyGenerator = ajaxProxyGenerator;
4. In the Configure method add:
configuration.JSGeneratorConfiguration.AddLibrary("jquery-1.2.1", typeof(JQueryGenerator))
.AddExtension(typeof(CommonJSExtension))
.ElementGenerator
.AddExtension(typeof(JQueryElementGenerator))
.Done
.BrowserValidatorIs(typeof(JQueryValidator))
.SetAsDefault();
5. In the layout file reference the JS files like:
<script language="javascript" type="text/javascript" src="${siteRoot}/Content/Js/jquery-1.2.6.min.js"></script>
<script language="javascript" type="text/javascript" src="${siteRoot}/Content/Js/jquery.validate.min.js"></script>
6. Use the Castle trunk source.
References:
http://hammett.castleproject.org/?p=238
http://groups.google.co.nz/group/castle-project-users/browse_thread/thread/eb5bb0e5b4560a97
http://endurotracker.blogspot.com/2008/09/jquery-and-monorail.html
http://www.nabble.com/jquery-proxy-generator-in-trunk-td19670846.html