Skip to content
Joakim Höglund edited this page Nov 9, 2019 · 1 revision

EZms Wiki

Detailed setup instructions:

Usage:

Attributes

  • PageDataAttribute (PageData) The PageData attribute is used to decorate a class that should be used as a page type. This enables EZms to identify the page types in the project. The PageData attribute has 2 properties, Name and Guid. Guid has to be a unique string.

    Example:

    [PageData(Guid = "7604de32-7d25-40f8-8f6a-448501c5da4f", Name = "Business Client")]
    public class BusinessClient : PageContent<BusinessClient> {
    ...
    }
  • IgnorePropertyAttrbibute (IgnoreProperty) This attribute can be used on a property level to exclude a property from the editor UI from a page type

    Example:

    [IgnoreProperty]
    public bool IsValid { get;set; }

Property types (UIHints)

Different UIHints will affect the way a property is represented in the Editor UI

Example page type with UIHints and all the bells and whistles:

    [PageData(Guid = "7604de32-7d25-40f8-8f6a-448501c5da4f", Name = "Business Client")]
    public class BusinessClient : PageContent<BusinessClient>
    {
        [Display( Name = "Background information", Order = 1, GroupName = "1. Information")]
        [UIHint(UIHints.Markdown)]
        public string BackgroundInformation { get; set; }
        
        [Display( Name = "Client since", Order = 5, GroupName = "1. Information")]
        [UIHint(UIHints.Date)]
        public DateTime ClientSinceDate { get; set; }

        [Display( Name = "Image", Order = 10, GroupName = "1. Information")]
        [UIHint(UIHints.Image)]
        public string Image { get; set; }
        
        [Display( Name = "Prices", Order = 15, GroupName = "4. Prices")]
        [UIHint(UIHints.EnumerableCollection)]
        public List<Price> Prices { get; set; }
        
        [Display( Name = "Invoices", Order = 20, GroupName = "4. Prices")]
        [UIHint(UIHints.EnumerableCollection)]
        public List<Invoice> Invoices { get; set; }
        
        [Display( Name = "Business events", Order = 25, GroupName = "2. Events")]
        public List<Event> Events { get; set; }
        
        [Display( Name = "Contacts", Order = 30, GroupName = "3. Contacts")]
        public List<Contact> Contacts { get; set; }
        
        [Display( Name = "Documents", Order = 35, GroupName = "1. Information")]
        [UIHint(UIHints.Gallery)]
        public List<string> Documents { get; set; }

    }

    public class Price
    {
        [Display(Name="Type", Order = 1)]
        public string Type { get; set; }

        [Display(Name="Amount", Order = 5)]
        public decimal Amount { get; set; }

        [Display(Name="Notation", Order = 10, Description = "Notation/Description")]
        [UIHint(UIHints.Markdown)]
        public string Notation { get; set; }
    }

    public class Invoice
    {
        [Display(Name = "Type", Order = 1)]
        public string Type { get; set; }

        [Display(Name = "Gross Amount", Order = 5)]
        public decimal GrossAmount { get; set; }

        [Display(Name = "Net Amount", Order = 5)]
        public decimal NetAmount { get; set; }

        [Display(Name = "Notation", Order = 10, Description = "Notation/Description")]
        [UIHint(UIHints.Markdown)]
        public string Notation { get; set; }

        [Display(Name = "Document", Order = 15)]
        [UIHint(UIHints.Image)]
        public string Document { get; set; }
    }

    public class Event
    {
        [Display( Name = "Date", Order = 1)]
        [UIHint(UIHints.Date)]
        public DateTime Date { get; set; }

        [Display( Name = "Description", Order = 5)]
        [UIHint(UIHints.Markdown)]
        public string Description { get; set; }
    }

    public class Contact
    {
        [Display( Name = "Name", Order = 1)]
        public string Name { get; set; }
        
        [Display( Name = "Position", Order = 5)]
        public string Position { get; set; }
        
        [Display( Name = "Email", Order = 10)]
        [EmailAddress]
        public string Email { get; set; }

        [Display( Name = "Phone number", Order = 15)]
        public string PhoneNumber { get; set; }

        [Display( Name = "Image", Order = 20)]
        [UIHint(UIHints.Image)]
        public string Image { get; set; }
    }
}
Clone this wiki locally