private static void AddLogout(HtmlTag header) { var logout = Tags.Link.Attr(HtmlAttributeConstants.Href, "authentication/logout") .Text("(logout)"); header.Nest(logout); }
private static void AddTitle(HtmlTag header) { var currentUser = UserPrincipal.Current.User; var userName = currentUser != null ? currentUser.Name : string.Empty; var title = Tags.SpanText("Feedback - " + userName); header .Nest(title); }
private static void AddAdminLink(HtmlTag header) { var currentUser = UserPrincipal.Current.User; var isAdmin = currentUser != null && currentUser.Role.HasFlag(Roles.Admin); if (isAdmin) { var admin = Tags.Link.Attr(HtmlAttributeConstants.Href, "admin/index") .Text("(admin)"); header.Nest(admin); } }
private void AddCriteria(HtmlTag div) { var table = Tags.Table; var row = table.AddBodyRow(); row.Cell("Target:"); row.Cell().Nest(Tags.Span.DataBind("text: Target")); row = table.AddBodyRow(); row.Cell("Source:"); // todo Ability to view from all sources row.Cell().Nest(Tags.Span.DataBind("text: Source")); row = table.AddBodyRow(); row.Cell("Metric:"); row.Cell().Nest(Tags.Span.DataBind("text: Metric")); div.Nest(table); }
private void AddFeedback(HtmlTag div) { var table = Tags.Table.Caption("Feedback"); var headerRow = table.AddHeaderRow(); headerRow.Cell("Date"); headerRow.Cell("From"); headerRow.Cell("Rating"); headerRow.Cell("Notes"); headerRow.Cell(); var addRow = new TableRowTag(); addRow.AddClass("top"); addRow.Cell().Nest(Tags.Span.DataBind("text: Date")); addRow.Cell().Nest(Tags.Span.DataBind("text: Source")); addRow.Cell().Nest(new GiveFeedback().InputFor(x => x.Rating).DataBind("value: Rating")); addRow.Cell().Nest(new HtmlTag("textarea").DataBind("value: Notes")); addRow.Cell().Nest( Tags.Link.Href("#").Text("Save").DataBind("click: function() { $parent.saveFeedback(); }")); var addBody = new HtmlTag("tbody").DataBind("with: NewFeedback"); addBody.Nest(addRow); var noteRow = new TableRowTag(); noteRow.AddClass("note"); noteRow.Cell().Nest(Tags.Span.DataBind("text: Date")); noteRow.Cell().Nest(Tags.Span.DataBind("text: Source")); noteRow.Cell().Nest(Tags.Span.DataBind("text: Rating")); noteRow.Cell().Nest(new HtmlTag("pre").Style("white-space", "pre-wrap").DataBind("text: Notes")); noteRow.Cell(); var notesBody = new HtmlTag("tbody").DataBind("foreach: Feedback"); notesBody.Nest(noteRow); table.Nest( addBody, notesBody ); table.AddClasses("report", "no-hover"); div.Nest(table); }
public static HtmlTag GetFeedbackTemplate() { var table = Tags.Table.Caption("Feedback"); var headerRow = table.AddHeaderRow(); headerRow.Cell("Date"); headerRow.Cell("From"); headerRow.Cell("Rating"); headerRow.Cell("Notes"); headerRow.Cell(); var addRow = new TableRowTag(); addRow.AddClass("top"); addRow.Cell().Nest(Tags.Span.DataBind("text: Date")); addRow.Cell().Nest(Tags.Span.DataBind("text: Source")); addRow.Cell().Nest(new GiveFeedback().InputFor(x => x.Rating).DataBind("value: Rating")); addRow.Cell().Nest(new HtmlTag("textarea").DataBind("text: Notes")); addRow.Cell().Nest(Tags.Link.Href("#").Text("Save").DataBind("click: function() { $parent.saveNote(); }")); var addBody = new HtmlTag("tbody").DataBind("with: Note"); addBody.Nest(addRow); var noteRow = new TableRowTag(); noteRow.AddClass("note"); noteRow.Cell().Nest(Tags.Span.DataBind("text: Date")); noteRow.Cell().Nest(Tags.Span.DataBind("text: Source")); noteRow.Cell().Nest(Tags.Span.DataBind("text: Rating")); noteRow.Cell().Nest(Tags.Span.DataBind("text: Notes")); noteRow.Cell(); var notesBody = new HtmlTag("tbody").DataBind("foreach: Feedback"); notesBody.Nest(noteRow); table.Nest( addBody, notesBody ); return table.AddClasses("report", "no-hover"); }