Example #1
0
        public static IHtmlString RenderTree(this HtmlHelper helper, TopicTree tree)
        {
            var writer = new HtmlTextWriter(new StringWriter());

            writer.RenderBeginTag(HtmlTextWriterTag.Ul);
            foreach (var section in tree.Sections)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Li);
                writer.Write(section.Name);
                if (section.Topics.Count > 0)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Ul);
                    foreach (var topic in section.Topics)
                    {
                        writer.RenderBeginTag(HtmlTextWriterTag.Li);
                        WriteLink(writer, topic);
                        writer.RenderEndTag();
                    }
                    writer.RenderEndTag();
                }
                writer.RenderEndTag();
            }
            writer.RenderEndTag();

            return MvcHtmlString.Create(writer.InnerWriter.ToString());
        }
Example #2
0
 private TopicTree FixLinks(TopicTree tree)
 {
     Topic previous = null;
     foreach (var section in tree.Sections)
     {
         section.Tree = tree;
         foreach (var topic in section.Topics)
         {
             if (topic.HasContent)
             {
                 if (previous != null)
                 {
                     topic.Previous = previous;
                     previous.Next = topic;
                 }
                 previous = topic;
             }
         }
     }
     return tree;
 }
Example #3
0
        private TopicTree FixLinks(TopicTree tree)
        {
            Topic previous = null;

            foreach (var section in tree.Sections)
            {
                section.Tree = tree;
                foreach (var topic in section.Topics)
                {
                    if (topic.HasContent)
                    {
                        if (previous != null)
                        {
                            topic.Previous = previous;
                            previous.Next  = topic;
                        }
                        previous = topic;
                    }
                }
            }
            return(tree);
        }
Example #4
0
 public DocsController(TopicTree tree)
 {
     _tree = tree;
 }