Ejemplo n.º 1
0
        public static IHxlElementTemplate Async(HxlElementTemplate template)
        {
            if (template == null)
            {
                throw new ArgumentNullException("template");
            }

            return(new AsyncTemplate(template));
        }
Ejemplo n.º 2
0
        protected override void WriteElement(DomElement element)
        {
            var frag = element as HxlElement;

            if (frag != null)
            {
                WriteElementFragment(frag);
                return;
            }

            // TODO Missing HTML settings and pretty print semantics
            IHxlElementTemplate template = HxlElementTemplate.ProcessAttributesForTemplate(element, TemplateContext);

            template = template ?? element.GetElementTemplate() ?? HxlElementTemplate.Default;

            template.Render(element, this);
        }
        internal static void Render(DomElement element,
                                    string name,
                                    string layoutName,
                                    HxlWriter hxlOutput)
        {
            var        templateContext = hxlOutput.TemplateContext;
            var        pc = templateContext.FindPlaceholderContent(name);
            DomElement content;

            if (pc == null)
            {
                content = element;
            }
            else
            {
                content    = pc.Element;
                layoutName = pc.Layout;
                MergeAttributes(content, element);
            }

            var attr = element.Attributes["class"];

            if (attr == null)
            {
                element.Attribute("class", "app-placeholder");
            }
            else
            {
                AttributeAppend(attr, "app-placeholder");
            }

            element.Attribute("data-placeholder", name);
            element.Attribute("data-layout", layoutName);

            // TODO Skip over single-page elements that were disabled
            // TODO Output correct locations
            var output = hxlOutput.BaseWriter;

            // TODO We always render element - should attribute selection be allowed to choose another element template?
            HxlElementTemplate.ProcessAttributesForTemplate(element, templateContext);
            HxlElementTemplate.RenderElementStart(element, output);

            hxlOutput.Write(content.ChildNodes);
            HxlElementTemplate.RenderElementEnd(element, output);
        }
Ejemplo n.º 4
0
 public AsyncTemplate(HxlElementTemplate template)
 {
     _template = template;
 }