예제 #1
0
 private Action <object, IHtmlNode> MapDetailViewTemplate(HtmlTemplate <T> detailViewTemplate)
 {
     return((dataItem, container) =>
     {
         if (detailViewTemplate != null && detailViewTemplate.HasValue())
         {
             detailViewTemplate.Apply((T)dataItem, container);
         }
     });
 }
        public virtual IClientSideObjectWriter Append(string name, HtmlTemplate htmlTemplate)
        {
            Guard.IsNotNullOrEmpty(name, "name");

            if (htmlTemplate.HasValue())
            {
                if (htmlTemplate.Content != null)
                {
                    EnsureStart();

                    writer.Write(appended ? ", " : "{");
                    writer.Write("{0}:'".FormatWith(name));
                    htmlTemplate.Content();
                    writer.Write("'");

                    return(this);
                }

                if (htmlTemplate.Html.HasValue())
                {
                    string formattedValue = QuoteString(htmlTemplate.Html);

                    Append("{0}:'{1}'".FormatWith(name, formattedValue));

                    return(this);
                }

                if (htmlTemplate.InlineTemplate != null)
                {
                    var inlineTemplate = htmlTemplate.InlineTemplate(null);

                    if (inlineTemplate != null)
                    {
                        string formattedValue = QuoteString(inlineTemplate.ToString());

                        Append("{0}:'{1}'".FormatWith(name, formattedValue));
                    }
                }
            }

            return(this);
        }