public void Init() { codeGen = new JSCodeGenerator(); generator = new PrototypeGenerator(codeGen); }
/// <summary> /// Initializes a new instance of the <see cref="PrototypeElementGenerator"/> class. /// </summary> /// <param name="generator">The generator.</param> /// <param name="root">The root.</param> public PrototypeElementGenerator(PrototypeGenerator generator, String root) { this.generator = generator; generator.CodeGenerator.Record("$('" + root + "')"); }
protected string ProcessViewJS(string templatePath) { StringWriter sw = new StringWriter(); ControllerContext.LayoutNames = Layouts; StubEngineContext.CurrentControllerContext = ControllerContext; DefaultViewEngineManager engineManager = new DefaultViewEngineManager(); engineManager.RegisterEngineForView(BooViewEngine); engineManager.RegisterEngineForExtesionLookup((BooViewEngine)); JSCodeGenerator codeGenerator = new JSCodeGenerator(StubEngineContext.Server, engineManager, StubEngineContext, null, ControllerContext, StubEngineContext.Services.UrlBuilder); IJSGenerator jsGen = new PrototypeGenerator(codeGenerator); codeGenerator.JSGenerator = jsGen; JSCodeGeneratorInfo info = new JSCodeGeneratorInfo(codeGenerator, jsGen, new object[] { new ScriptaculousExtension(codeGenerator) }, new object[] { new ScriptaculousExtension(codeGenerator) }); BooViewEngine.GenerateJS(templatePath, sw, info, StubEngineContext, null, ControllerContext); lastOutput = sw.ToString(); return lastOutput; }
/// <summary> /// Initializes a new instance of the <see cref="PrototypeElementGenerator"/> class. /// </summary> /// <param name="generator">The generator.</param> /// <param name="root">The root.</param> public PrototypeElementGenerator(PrototypeGenerator generator, String root) { this.generator = generator; generator.CodeGenerator.Record("$('" + root + "')"); }