Created AdminContext handling

This commit is contained in:
2024-09-30 19:01:39 +02:00
parent 672f0fd2c3
commit 66ddc22012
33 changed files with 582 additions and 7 deletions

View File

@@ -0,0 +1,52 @@
using HopFrame.Web.Admin.Models;
namespace HopFrame.Web.Admin.Generators.Implementation;
internal sealed class AdminPropertyGenerator(string name, Type type) : IAdminPropertyGenerator, IGenerator<AdminPageProperty> {
private readonly AdminPageProperty _property = new() {
Name = name,
Type = type
};
public IAdminPropertyGenerator Sortable(bool sortable) {
_property.Sortable = sortable;
return this;
}
public IAdminPropertyGenerator Editable(bool editable) {
_property.Editable = editable;
return this;
}
public IAdminPropertyGenerator DisplayValueWhileEditing(bool display) {
_property.EditDisplayValue = display;
return this;
}
public IAdminPropertyGenerator DisplayInListing(bool display = true) {
_property.DisplayInListing = display;
return this;
}
public IAdminPropertyGenerator Bold(bool isBold = true) {
_property.Bold = isBold;
return this;
}
public IAdminPropertyGenerator DisplayName(string displayName) {
_property.DisplayName = displayName;
return this;
}
public IAdminPropertyGenerator Description(string description) {
_property.Description = description;
return this;
}
public AdminPageProperty Compile() {
_property.DisplayName ??= _property.Name;
return _property;
}
}