public override void Configure(FluidityConfig config) { config.AddSection("Database", "icon-server-alt", sectionConfig => { sectionConfig.SetTree("Database", treeConfig => { treeConfig.AddCollection <Person>(p => p.Id, "Person", "People", "A collection of people", "icon-umb-users", "icon-umb-users", collectionConfig => { collectionConfig.SetNameProperty(p => p.Name); collectionConfig.SetViewMode(FluidityViewMode.List); collectionConfig.ListView(listViewConfig => { listViewConfig.AddField(p => p.JobTitle); listViewConfig.AddField(p => p.Email); }); collectionConfig.Editor(editorConfig => { editorConfig.AddTab("General", tabConfig => { tabConfig.AddField(p => p.JobTitle).MakeRequired(); tabConfig.AddField(p => p.Email).SetValidationRegex("[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+"); tabConfig.AddField(p => p.Telephone).SetDescription("inc area code"); tabConfig.AddField(p => p.Age); }); editorConfig.AddTab("Media", tabConfig => { tabConfig.AddField(p => p.Avatar).SetDataType("Upload"); }); }); }); }); }); }
public override void Configure(FluidityConfig config) { // Create the Printer Admin section config.AddSection("Printer Admin", "icon-print", sectionConfig => { // Create the tree for the Printer Admin section sectionConfig.SetTree("Printer Admin", treeConfig => { // Create the collection that will hold the Printers that are to be listed treeConfig.AddCollection <Printer>(x => x.Id, "Printer", "Printers", "A collection of printers", "icon-print", "icon-folder", collectionConfig => { collectionConfig.SetNameFormat(x => { return($"{x.FriendlyName} ({x.IpAddress})"); }); collectionConfig.SetRepositoryType <PrinterRepository>(); // Create the editor that will allow a user to update the Printer details collectionConfig.Editor(editorConfig => { editorConfig.AddTab("General", tabConfig => { tabConfig.AddField(x => x.Name, field => { field.SetLabel("Name") .SetDescription("Specify the name of the entity that is used internally") .MakeRequired(); }); tabConfig.AddField(x => x.FriendlyName, field => { field.SetLabel("Friendly Name") .SetDescription("The friendly name of the printer") .MakeRequired(); }); tabConfig.AddField(x => x.IpAddress, field => { field.SetLabel("IP Address") .SetDescription("The IP Address that the printer can be accessed on") .MakeRequired(); }); }); }); }); }); }); }