/// <summary> /// Defines the jobs backend content view. /// </summary> /// <param name="parent">The parent.</param> /// <returns></returns> public static ContentViewControlElement DefineJobsBackendContentView(ConfigElement parent) { // define content view control var backendContentView = new ContentViewControlElement(parent) { ControlDefinitionName = BackendDefinitionName, ContentType = typeof(JobApplication) }; // define views var jobsGridView = new MasterGridViewElement(backendContentView.ViewsConfig) { ViewName = JobsDefinitions.BackendListViewName, ViewType = typeof(MasterGridView), AllowPaging = true, DisplayMode = FieldDisplayMode.Read, ItemsPerPage = 50, ResourceClassId = typeof(JobsResources).Name, Title = "JobsViewTitle", WebServiceBaseUrl = "~/Sitefinity/Services/Content/Jobs.svc/", }; // define columns var gridMode = new GridViewModeElement(jobsGridView.ViewModesConfig) { Name = "Grid", }; jobsGridView.ViewModesConfig.Add(gridMode); DataColumnElement firstNameColumn = new DataColumnElement(gridMode.ColumnsConfig) { Name = "FirstName", HeaderText = Res.Get <JobsResources>().FirstName, ClientTemplate = "<span>{{FirstName}}</span>", HeaderCssClass = "sfRegular", ItemCssClass = "sfRegular" }; gridMode.ColumnsConfig.Add(firstNameColumn); DataColumnElement lastNameColumn = new DataColumnElement(gridMode.ColumnsConfig) { Name = "LastName", HeaderText = Res.Get <JobsResources>().LastName, ClientTemplate = "<span>{{LastName}}</span>", HeaderCssClass = "sfRegular", ItemCssClass = "sfRegular" }; gridMode.ColumnsConfig.Add(lastNameColumn); DataColumnElement phoneColumn = new DataColumnElement(gridMode.ColumnsConfig) { Name = "Phone", HeaderText = Res.Get <JobsResources>().PhoneNumber, ClientTemplate = "<span>{{Phone}}</span>", HeaderCssClass = "sfRegular", ItemCssClass = "sfRegular" }; gridMode.ColumnsConfig.Add(phoneColumn); DataColumnElement refferalColumn = new DataColumnElement(gridMode.ColumnsConfig) { Name = "Refferal", HeaderText = Res.Get <JobsResources>().Referrer, ClientTemplate = "<span>{{Referral}}</span>", HeaderCssClass = "sfRegular", ItemCssClass = "sfRegular" }; gridMode.ColumnsConfig.Add(refferalColumn); ActionMenuColumnElement actionsColumn = new ActionMenuColumnElement(gridMode.ColumnsConfig) { Name = "Actions", HeaderText = Res.Get <Labels>().Actions, HeaderCssClass = "sfMoreActions", ItemCssClass = "sfMoreActions" }; FillActionMenuItems(actionsColumn.MenuItems, actionsColumn, typeof(JobsResources).Name); gridMode.ColumnsConfig.Add(actionsColumn); DataColumnElement authorColumn = new DataColumnElement(gridMode.ColumnsConfig) { Name = "Author", HeaderText = Res.Get <Labels>().Author, ClientTemplate = "<span>{{Author}}</span>", HeaderCssClass = "sfRegular", ItemCssClass = "sfRegular" }; gridMode.ColumnsConfig.Add(authorColumn); DataColumnElement dateColumn = new DataColumnElement(gridMode.ColumnsConfig) { Name = "Date", HeaderText = Res.Get <Labels>().Date, ClientTemplate = "<span>{{ (DateCreated) ? DateCreated.sitefinityLocaleFormat('dd MMM, yyyy hh:mm:ss'): '-' }}</span>", HeaderCssClass = "sfDate", ItemCssClass = "sfDate" }; gridMode.ColumnsConfig.Add(dateColumn); backendContentView.ViewsConfig.Add(jobsGridView); var parameters = string.Concat( "?ControlDefinitionName=", JobsDefinitions.BackendDefinitionName, "&ViewName=", JobsDefinitions.BackendEditViewName); DialogElement editDialogElement = DefinitionsHelper.CreateDialogElement( jobsGridView.DialogsConfig, DefinitionsHelper.EditCommandName, "ContentViewEditDialog", parameters); jobsGridView.DialogsConfig.Add(editDialogElement); var jobsEditDetailView = new DetailFormViewElement(backendContentView.ViewsConfig) { Title = "EditItem", ViewName = JobsDefinitions.BackendEditViewName, ViewType = typeof(DetailFormView), ShowSections = true, DisplayMode = FieldDisplayMode.Write, ShowTopToolbar = true, ResourceClassId = typeof(JobsResources).Name, WebServiceBaseUrl = "~/Sitefinity/Services/Content/Jobs.svc/", IsToRenderTranslationView = false, UseWorkflow = false }; backendContentView.ViewsConfig.Add(jobsEditDetailView); JobsDefinitions.CreateBackendSections(jobsEditDetailView, FieldDisplayMode.Write); JobsDefinitions.CreateBackendFormToolbar(jobsEditDetailView, typeof(JobsResources).Name, false); return(backendContentView); }
private static void CreateBackendFormToolbar(DetailFormViewElement detailView, string resourceClassId, bool isCreateMode) { JobsDefinitions.CreateBackendFormToolbar(detailView, resourceClassId, isCreateMode, "ThisItem", true); }