38 lines
798 B
C#
38 lines
798 B
C#
using FluentValidation;
|
|
using zero.Core.Renderer;
|
|
|
|
namespace zero.TestData
|
|
{
|
|
public class ContentPageRenderer : AbstractRenderer<ContentPage>
|
|
{
|
|
public ContentPageRenderer()
|
|
{
|
|
Alias = "debug.contentpage";
|
|
|
|
LabelTemplate = "@_test.fields.{0}";
|
|
DescriptionTemplate = "@_test.fields.{0}_text";
|
|
|
|
Field(x => x.Name, required: true).Text();
|
|
|
|
Tab("Options", () =>
|
|
{
|
|
Field(x => x.Options).Renderer(new OptionsPagePartialRenderer());
|
|
});
|
|
|
|
Tab("Meta", () =>
|
|
{
|
|
Field(x => x.Meta).Renderer(new MetaPagePartialRenderer());
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
public class ContentPageValidator : AbstractValidator<ContentPage>
|
|
{
|
|
public ContentPageValidator()
|
|
{
|
|
RuleFor(x => x.Name).NotEmpty().MaximumLength(30);
|
|
}
|
|
}
|
|
}
|