override public int Write(IStringTemplateWriter output) { SetPredefinedAttributes(); SetDefaultArgumentValues(); //IRailsEngineContext context = (IRailsEngineContext) GetAttribute(ConfigConstants.CONTEXT_ATTRIB_KEY); IRailsEngineContext context = MonoRailHttpHandler.CurrentContext; StringWriter writer = new StringWriter(); StringTemplateViewContextAdapter viewComponentContext = new StringTemplateViewContextAdapter(viewComponentName, this); viewComponentContext.TextWriter = writer; viewComponent.Init(context, viewComponentContext); viewComponent.Render(); if (viewComponentContext.ViewToRender != null) { StringTemplate viewST = group.GetEmbeddedInstanceOf(this, viewComponentContext.ViewToRender); writer.Write(viewST.ToString()); } if (viewComponentName.Equals("CaptureFor")) { string keyToSet = (string)GetAttribute("id"); object valToSet = GetAttribute(keyToSet); OutermostEnclosingInstance.RemoveAttribute(keyToSet); OutermostEnclosingInstance.SetAttribute(keyToSet, valToSet); } output.Write(writer.ToString()); // if (LintMode) // { // CheckForTrouble(); // } return(0); }
override public int Write(IStringTemplateWriter output) { SetPredefinedAttributes(); SetDefaultArgumentValues(); //IRailsEngineContext context = (IRailsEngineContext) GetAttribute(ConfigConstants.CONTEXT_ATTRIB_KEY); IRailsEngineContext context = MonoRailHttpHandler.CurrentContext; StringWriter writer = new StringWriter(); StringTemplateViewContextAdapter viewComponentContext = new StringTemplateViewContextAdapter(viewComponentName, this); viewComponentContext.TextWriter = writer; viewComponent.Init(context, viewComponentContext); viewComponent.Render(); if (viewComponentContext.ViewToRender != null) { StringTemplate viewST = group.GetEmbeddedInstanceOf(this, viewComponentContext.ViewToRender); writer.Write(viewST.ToString()); } if (viewComponentName.Equals("CaptureFor")) { string keyToSet = (string) GetAttribute("id"); object valToSet = GetAttribute(keyToSet); OutermostEnclosingInstance.RemoveAttribute(keyToSet); OutermostEnclosingInstance.SetAttribute(keyToSet, valToSet); } output.Write(writer.ToString()); // if (LintMode) // { // CheckForTrouble(); // } return 0; }