WebTemplate.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using InABox.Core;
  2. namespace Comal.Classes
  3. {
  4. /* A WebTemplate represents the html template used for building web pages. */
  5. public class WebTemplate : Entity, IRemotable, IPersistent, ILicense<WebAccessLicense>, IExportable, IImportable, ISecure
  6. {
  7. [TextBoxEditor]
  8. [EditorSequence(1)]
  9. public string DataModel { get; set; }
  10. [TextBoxEditor]
  11. [EditorSequence(2)]
  12. public string Slug { get; set; } = "";
  13. [TextBoxEditor]
  14. [EditorSequence(3)]
  15. public string Description { get; set; }
  16. [ScriptEditor(SyntaxLanguage.HTML)]
  17. [EditorSequence(4)]
  18. public string Template { get; set; } = "";
  19. [CheckBoxEditor]
  20. [EditorSequence(5)]
  21. public bool Visible { get; set; } = false;
  22. /// <summary>
  23. /// Determines whether the URL endpoint is prefixed with "v1/" - this should be the default, to allow us, PRS, to add endpoints to the Web Engine.<br/>
  24. /// A client who sets this to <see langword="true"/> does so at their own risk.<br/>
  25. /// However, to minimise conflict, I propose that we only create internal endpoints that begin with a lower case letter,
  26. /// thus allowing all upper-case letters to be used by clients.
  27. /// </summary>
  28. [CheckBoxEditor(Visible = InABox.Core.Visible.Optional)]
  29. [EditorSequence(5)]
  30. public bool RootURL { get; set; } = false;
  31. public override string ToString()
  32. {
  33. return RootURL ? $"{DataModel}/{Slug}" : $"v1/{DataModel}/{Slug}";
  34. }
  35. }
  36. }