public static string GetCharisma_Alert(Charisma_AlertType type, string title, string msg) { var tag = new HtmlTag("div").AddClass("alert").AddClass(type.ToText()); tag.Add("button").AddClass("close").Attr("type", "button").Attr("data-dismiss", "alert").Text("×"); tag.Add("h4").AddClass("alert-heading").Text(title); tag.Add("p").Text(msg); return tag.ToString(); }
public HtmlDocument() { RootTag = new HtmlTag("html"); DocType = "<!DOCTYPE html>"; Head = RootTag.Add("head"); _title = Head.Add("title"); Body = RootTag.Add("body"); Last = Body; }
public HtmlDocument() { RootTag = new HtmlTag("html"); DocType = "<!DOCTYPE html>"; _head = RootTag.Add("head"); _title = _head.Add("title"); _body = RootTag.Add("body"); Last = _body; }
public static string GetCharisma_Alert(Charisma_AlertType type, string title, IList<ValidationFailure> content) { var tag = new HtmlTag("div").AddClass("alert").AddClass(type.ToText()); tag.Add("button").AddClass("close").Attr("type", "button").Attr("data-dismiss", "alert").Text("×"); tag.Add("h4").AddClass("alert-heading").Text(title); foreach (var item in content) { tag.Add("p").Text(item.ErrorMessage); } return tag.ToString(); }
public void find_first_child() { var tag = new HtmlTag("a"); tag.Add("span"); tag.Add("span"); var div = tag.Add("div"); tag.Add("input"); tag.Add("button"); new TagHolder(tag).ForChild("div").ShouldBeTheSameAs(div); }
public HtmlTag get_scheduled_jobs() { var tag = new HtmlTag("div"); tag.Add("h1").Text("Scheduled Jobs Monitor"); tag.Add("p").Text("at {0} -- reload the page to refresh the data".ToFormat(DateTime.Now)); var schedule = _persistence.FindAll(_graph.Name); tag.Append(new ScheduledJobTable(_urls, schedule)); return tag; }
public string Transform(Topic current, string data) { var ol = new HtmlTag("ol").AddClass("breadcrumb"); current.Ancestors().Each(x => { ol.Add("li/a").Attr("href", _resolver.ToUrl(current, x)).Text(x.Title); }); ol.Add("li").AddClass("active").Text(current.Title); return ol.ToString(); }
public OutlineNodeTag(string label, string anchor = null) : base("li") { _container = Add("div").AddClass("node-container"); if (anchor.IsEmpty()) { _container.Add("span").Text(label); } else { _container.Add("a").Attr("href", "#" + anchor).Text(label); } }
public HtmlTag BuildFolderTag(SpecificationFolder folder) { var folderTag = new HtmlTag("li"); var link = linkTagForFolder(folder); folderTag.Add("span").AddClass("folder").Append(link); var ul = folderTag.Add("ul"); var builder = new ChildTagBuilder(this, ul); folder.ImmediateChildren.Each(x => x.AcceptVisitor(builder)); return folderTag; }
public HtmlTag get_subscriptions() { var div = new HtmlTag("div"); div.Add("h3").Text("Subscription Persistence"); div.Append( new DescriptionBodyTag(Description.For(_persistence))); div.Add("h3").Text("Nodes"); div.Append(new TransportNodeTableTag(_persistence.AllNodes())); div.Add("h3").Text("Subscriptions"); div.Append(new SubscriptionStorageTableTag(_persistence.AllSubscriptions())); return div; }
public HtmlTag get_tasks() { var peers = _repository.FindPeers(); var cache = new Cache<Uri, TransportNode>(); peers.Each(peer => peer.OwnedTasks.Each(x => cache[x] = peer)); var tag = new HtmlTag("div"); tag.Add("h1").Text("Task Assignements"); var table = new TableTag(); tag.Append(table); table.AddClass("table"); table.AddHeaderRow(row => { row.Header("Task"); row.Header("Assigned to"); row.Header("Control Channel"); }); var tasks = _tasks.PermanentTasks().Union(_tasks.ActiveTasks()).ToArray(); tasks.Each(uri => { table.AddBodyRow(row => addRow(row, uri, cache)); }); return tag; }
public static HtmlTag ChildNodesRecursiveHtmlTag(this IDocumentNode currentNode, IDocumentNode IDocumentNode, int allExpandToLevel = 2, bool includeHidden = false, bool includeDeleted = false, string addAdminPath = "") { var ul = new HtmlTags.HtmlTag("ul"); foreach (var c in IDocumentNode.Children.Where(n => (includeDeleted || !n.IsDeleted) && (includeHidden || !n.IsHidden))) { var li = new HtmlTags.HtmlTag("li"); var path = addAdminPath + c.Url; li.Add("a").Attr("href", path).Text(c.Name); if (c == currentNode) { li.AddClass("selected"); } if (c.IsDescendantOrSameAs(currentNode)) { li.AddClass("sel"); } if (c.Children.Count > 0 && (c.Level < allExpandToLevel || c.IsDescendantOrSameAs(currentNode) || currentNode.IsDescendantOrSameAs(c))) { li.Children.Add(ChildNodesRecursiveHtmlTag(currentNode, c, allExpandToLevel, includeHidden, includeDeleted, addAdminPath)); } ul.Children.Add(li); } return(ul); }
public ConventionsViewModel get_conventions() { var configTypes = new string[] { ConfigurationType.Settings, ConfigurationType.Discovery, ConfigurationType.Explicit, ConfigurationType.Policy, ConfigurationType.Attributes, ConfigurationType.ModifyRoutes, ConfigurationType.InjectNodes, ConfigurationType.Conneg, ConfigurationType.Attachment, ConfigurationType.Navigation, ConfigurationType.ByNavigation, ConfigurationType.Reordering, ConfigurationType.Instrumentation }; var tag = new HtmlTag("ul"); configTypes.Each(configType => { tag.Add("li/a").Text(configType).Attr("href", "#" + configType); }); return new ConventionsViewModel { Descriptions = new TagList(configTypes.Select(configType => new ConfigurationTypeTag(configType, _graph))), TableOfContents = tag }; }
public HtmlDocument() { _head = _top.Add("head"); _title = _head.Add("title"); _body = _top.Add("body"); _last = _body; }
public HtmlDocument() { DocType = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; _head = _top.Add("head"); _title = _head.Add("title"); _body = _top.Add("body"); _last = _body; }
public HtmlTag VisualizePartial(BehaviorFinish finish) { var description = Description.For(finish.Correlation.Node); var tag = new HtmlTag("div").AddClass("behavior-finish"); tag.Add("span").Text("Finished ").Add("i").Text(description.Title); if (!finish.Succeeded) { tag.Next = new ExceptionReportTag(finish.Exception); tag.Add("span").Text(finish.Exception.ExceptionType).AddClass("exception"); } tag.PrependGlyph("icon-chevron-up"); return tag; }
public HtmlTag HtmlPartial(PartialRequest request) { var inner = new HtmlTag("div"); for (var i = 0; i < 5; i++) { inner.Add("p").Text(Guid.NewGuid().ToString()); } return inner; }
public HtmlTag get_description_Name(DescriptionRequest request) { var description = DescriptionBag.DescriptionFor(request.Name); var tag = new HtmlTag("div"); tag.Add("h4").Text(description.Title); tag.Append(new DescriptionBodyTag(description)); return tag; }
public override HtmlTag ToLeafTag() { var tag = new HtmlTag("li").Text(Description); var root = tag.Add("ol"); allRecordNodes() .OrderBy(x => x.Timestamp) .Select(x => x.ToLeafTag()) .Each(x => root.Append(x)); return tag; }
public HomeViewModel Index() { var outline = new HtmlTag("ul"); _service.MenuFor(new NavigationKey("TwitterBootstrap")).Each(token => { outline.Add("li").Add("a").Text(token.Text).Attr("href", token.Url); }); return new HomeViewModel{ Outline = outline }; }
private static void writeJavascript(BatchRunResponse results, HtmlDocument document) { var cleanJson = JsonSerialization.ToCleanJson(results); document.Body.Add("div").Hide().Id("batch-data").Text(cleanJson); document.Body.Add("div").Id("main"); var js = readFile("StoryTeller.batch-bundle.js"); var foot = new HtmlTag("foot"); document.Body.Next = foot; foot.Add("script").Attr("language", "javascript").Text("\n\n" + js + "\n\n").Encoded(false); }
public HtmlTag Group(GroupRequest request) { var group = _graph.FindGroup(request.Name); var tag = new HtmlTag("div"); tag.Add("h1").Text(group.Name); if (group.Description.IsNotEmpty()) { tag.Add("p/i").Text(group.Description); } var ul = tag.Add("ul"); group.Links().Each(x => { ul.Add("li/a") .Text(x.Title) .Attr("title", x.Description) .Attr("href", _httpRequest.ToFullUrl(x.GetRoutePattern())); }); return tag; }
public static HtmlDocument BuildDocument(IUrlRegistry urls, string title, params HtmlTag[] tags) { string css = GetDiagnosticCss(); var realTitle = "FubuMVC: " + title; var document = new HtmlDocument(); document.Title = realTitle; var mainDiv = new HtmlTag("div").AddClass("main"); mainDiv.Add("h2").Text("FubuMVC Diagnostics").Append(buildVersionTag()); var navBar = mainDiv.Add("div").AddClass("homelink"); if (urls != null) navBar.Append(new LinkTag("Home", urls.UrlFor<BehaviorGraphWriter>(w => w.Index(), null))); navBar.Add("span").Text(" > " + title); document.Add(mainDiv); mainDiv.Append(tags); document.AddStyle(css); return document; }
public static HtmlDocument BuildDocument(IUrlRegistry urls, string title, params HtmlTag[] tags) { var css = GetResourceText(typeof(BehaviorGraphWriter), "diagnostics.css"); var realTitle = "FubuMVC: " + title; var document = new HtmlDocument(); document.Title = realTitle; var mainDiv = new HtmlTag("div").AddClass("main"); mainDiv.Add("h2").Text("FubuMVC Diagnostics").Child(buildVersionTag()); var navBar = mainDiv.Add("div").AddClass("homelink"); navBar.AddChildren(new LinkTag("Home", urls.UrlFor<BehaviorGraphWriter>(w => w.Index()))); navBar.Add("span").Text(" > " + title); document.Add(mainDiv); mainDiv.AddChildren(tags); document.AddStyle(css); return document; }
public string Transform(Topic current, string data) { var props = data.Split(';'); var key = props.First(); try { var other = findOther(current, key); if (other == null) return string.Empty; return transformFromTopic(current, other, props); } catch (ArgumentOutOfRangeException) { var tag = new HtmlTag("p").AddClass("bg-warning").Style("padding", "5px"); tag.Add("b").Text("Unknown topic key '{0}'".ToFormat(key)); tag.Add("small").Text(" -- CTRL+SHIFT+R to force refresh the topic tree"); return tag.ToString(); } }
public void WriteBody(BehaviorChain chain, HtmlTag row, HtmlTag cell) { if (!chain.Authorization.HasRules()) { cell.Text(" [None] "); return; } cell.Add("ul", ul => { var authorizor = _factory.AuthorizorFor(chain.UniqueId); authorizor.RulesDescriptions().Each(rule => { ul.Add("li").Text(rule); }); }); }
private void writeChildren(MenuItemToken item, HtmlTag link) { link.AddClass("dropdown-toggle"); link.Attr("data-toggle", "dropdown"); link.Add("b").AddClass("caret"); var ul = Add("ul").AddClass("dropdown-menu"); item.Children.Each(child => { var childTag = new MenuItemTag(child); ul.Append(childTag); }); }
public static HtmlString ChildNodes(this IDocumentNode IDocumentNode, int atLevel = 0, bool includeHidden = false, bool includeDeleted = false) { var ul = new HtmlTags.HtmlTag("ul"); ul.AddClass("topnavigation"); foreach (var c in IDocumentNode.AncestorAtLevel(atLevel).Children.Where(n => (includeDeleted || !n.IsDeleted) && (includeHidden || !n.IsHidden))) { var li = new HtmlTags.HtmlTag("li"); if (IDocumentNode.IsDescendantOrSameAs(c)) li.AddClass("selected"); li.Add("a").Attr("href", c.Url).Text(c.Name); ul.Children.Add(li); } return new HtmlString(ul.ToHtmlString()); }
private void writeFormData(HtmlTag tag) { if (_report.FormData.Count == 0) return; tag.Add("h4").Text("Form Data"); var table = tag.Add("div").AddClass("formData").Child<TableTag>(); table.AddHeaderRow(row => { row.Header("Key"); row.Header("Value"); }); _report.FormData.Each(pair => { table.AddBodyRow(row => { row.Cell(pair.Key); if (pair.Value != null) row.Cell(pair.Value.ToString()); }); }); }
public static HtmlTag BuildListOfRoles(BehaviorGraph behaviors, Action<BehaviorChain, HtmlTag> buildChainElement) { var tag = new HtmlTag("ul"); var collector = new RoleCollector(); collector.Register(behaviors); collector.AllRoleSets().Each(role => { var li = tag.Add("li").Text(role.Role); var ul = li.Add("ul"); role.Chains.Each(c => buildChainElement(c, ul.Add("li"))); }); return tag; }
public void Start(string description, DateTime runningTime) { _document = new HtmlDocument(); _document.AddStyle(HtmlClasses.CSS()); _document.Add("h1").Text(description); _document.AddJavaScript(HtmlClasses.JQuery()); _document.AddJavaScript(HtmlClasses.SummaryFilter()); _document.Add("div").Text("Executed at {0}".ToFormat(runningTime)).AddClass(HtmlClasses.CAPTION); _document.Add("hr"); // _document and _table are HtmlTag objects _table = _document.Add("table"); _table.Add("thead/tr", x => { x.Add("th").Text("Test"); x.Add("th").Text("Lifecycle"); x.Add("th").Text("Result"); }); _tbody = _table.Add("tbody"); }
public static HtmlString ChildNodes(this IDocumentNode IDocumentNode, int atLevel = 0, bool includeHidden = false, bool includeDeleted = false) { var ul = new HtmlTags.HtmlTag("ul"); ul.AddClass("topnavigation"); foreach (var c in IDocumentNode.AncestorAtLevel(atLevel).Children.Where(n => (includeDeleted || !n.IsDeleted) && (includeHidden || !n.IsHidden))) { var li = new HtmlTags.HtmlTag("li"); if (IDocumentNode.IsDescendantOrSameAs(c)) { li.AddClass("selected"); } li.Add("a").Attr("href", c.Url).Text(c.Name); ul.Children.Add(li); } return(new HtmlString(ul.ToHtmlString())); }
public TableTag AddFooterRow(Action <TableRowTag> configure) { _footer.Render(true); configure(_footer.Add <TableRowTag>()); return(this); }
public TableRowTag AddHeaderRow() { return(_header.Add <TableRowTag>()); }
public TableRowTag AddBodyRow() { return(_body.Add <TableRowTag>()); }
public HtmlTag VisualizeException(ExceptionReport report) { var tag = new HtmlTag("div"); tag.Add("p").Add("b").Text("Exception: " + report.ExceptionType); tag.Add("pre").AddClass("text-warning").Text(report.ExceptionText); return tag; }