public ActionResult WidgetContentOne() { System.Threading.Thread.Sleep(1000); // Fake waiting time to show javascript spinner var model = new ContentViewModel(); model.AddSubTitle("A content based block"); model.AddParagraph("A content based widget with lots of information."); model.AddListItem("A list with items"); model.AddListItem("Another list item"); model.AddParagraph("Some further text after the list contains even more words, and punctuation marks as well."); return(PartialView("EditorTemplates/ContentViewModel", model)); }
public void AddParagraphTest() { var target = new ContentViewModel(); const string text = "A test for paragraph {0}"; ContentViewModel actual = target.AddParagraph(text); target.AddParagraph("Test"); Assert.IsTrue(actual.GetContent().Any()); var p = actual.GetContent().First(); Assert.AreEqual(ContentType.Paragraph, p.Type); Assert.AreEqual(text, p.Text); Assert.AreEqual("Test", actual.GetContent().Last().Text); }
public ActionResult Index() { var simpleModel = new ContentViewModel().AddTitle("Report examples"); simpleModel.AddParagraph("This area contains examples of generating reports using the Employment.Esc.Framework.Reporting.dll."); return(View(simpleModel)); }
/// <summary> /// Error page for HTTP Status Code 500 (internal server error). /// </summary> //[Menu("Application Error")] public ActionResult Http500() { PageTitle = "Application Error"; // Set response headers incase the user goes directly to this action Response.StatusCode = 500; Response.TrySkipIisCustomErrors = true; List <string> errorIDs; // Get logged error ID's for current request if (!UserService.Session.TryGet(MvcApplication.LoggedErrorIDKey, out errorIDs)) { errorIDs = new List <string>(); } // Clear stored logged error ID's for current request so next request starts with no logged error ID's UserService.Session.Remove(MvcApplication.LoggedErrorIDKey); var model = new ContentViewModel() .AddTitle("Application Error") .AddParagraph("The server encountered an internal error and was unable to process your request. Please try again later."); if (errorIDs.Any()) { if (errorIDs.Count == 1) { model.BeginParagraph() .AddText("Your error ID is: ") .AddStrongText(errorIDs.FirstOrDefault()) .EndParagraph(); } else { model.AddParagraph("Your error ID's are:") .BeginUnorderedList(); foreach (var errorID in errorIDs) { model.BeginListItem() .AddStrongText(errorID) .EndListItem(); } model.EndUnorderedList(); } } model.BeginParagraph() .AddText("For assistance, please contact the ES Help Desk on 1300 305 520 or ") .AddEmailLink("*****@*****.**") .AddText(".") .EndParagraph(); model.Hidden = new[] { LayoutType.LeftHandNavigation, LayoutType.RequiredFieldsMessage }; return(View(model)); }
public ActionResult WidgetContentFive(string widgetContext) { System.Threading.Thread.Sleep(1000); // Fake waiting time to show javascript spinner var model = new ContentViewModel(); model.AddSubTitle("Data context: " + (UserService.Dashboard.GetDataContext(widgetContext) ?? "not set")); model.AddParagraph("This model changes its information based on the data context, set in the right hand sidebar."); model.AddParagraph("It is useful for making a set of widgets display a different kind of information as a whole."); model.AddParagraph("A user selected data context is saved for that user across all pages/widgets"); model.AddParagraph("You can access the Data Context in your widget controllers using the dashboard service:"); model.AddPreformatted(@" public ActionResult WidgetContentFive(string widgetContext) { ... string dataContext = UserService.Dashboard.GetDataContext(widgetContext); ... } "); return(PartialView("EditorTemplates/ContentViewModel", model)); }