Example #1
0
        public void RenderPage(RedwoodRequestContext context, RedwoodView view)
        {
            // embed resource links
            EmbedResourceLinks(view);

            // prepare the render context
            var renderContext = new RenderContext(context);

            // get the HTML
            using (var textWriter = new StringWriter())
            {
                var htmlWriter = new HtmlWriter(textWriter, context);
                view.Render(htmlWriter, renderContext);
                context.RenderedHtml = textWriter.ToString();
            }
        }
 public JObject BuildResourcesJson(RedwoodRequestContext context, Func<string, bool> predicate)
 {
     var manager = context.ResourceManager;
     var resourceObj = new JObject();
     foreach(var resource in manager.GetNamedResourcesInOrder())
     {
         if (predicate(resource.Name))
         {
             using (var str = new StringWriter())
             {
                 var w = new HtmlWriter(str, context);
                 resource.Resource.Render(w);
                 resourceObj[resource.Name] = JValue.CreateString(str.ToString());
             }
         }
     }
     return resourceObj;
 }