formMessages.pug 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. include ./material_symbol
  2. mixin formMessages
  3. div(data-ol-form-messages='' role='alert')
  4. mixin formMessagesNewStyle(extraClass = 'form-messages-bottom-margin')
  5. - const attrs = extraClass ? {class: extraClass} : {}
  6. div(data-ol-form-messages-new-style='' role='alert')&attributes(attrs)
  7. mixin customFormMessage(key, kind)
  8. if kind === 'success'
  9. .alert.alert-success(
  10. hidden
  11. data-ol-custom-form-message=key
  12. role='alert'
  13. aria-live='polite'
  14. )
  15. block
  16. else if kind === 'danger'
  17. .alert.alert-danger(
  18. hidden
  19. data-ol-custom-form-message=key
  20. role='alert'
  21. aria-live='assertive'
  22. )
  23. block
  24. else
  25. .alert.alert-warning(
  26. hidden
  27. data-ol-custom-form-message=key
  28. role='alert'
  29. aria-live='polite'
  30. )
  31. block
  32. mixin customFormMessageNewStyle(key, kind, extraClass = 'mb-3')
  33. - extraClass = extraClass ? ' ' + extraClass : ''
  34. if kind === 'success'
  35. div(
  36. class='notification notification-type-success' + extraClass
  37. hidden
  38. data-ol-custom-form-message=key
  39. role='alert'
  40. aria-live='polite'
  41. )
  42. .notification-icon
  43. +material-symbol('check_circle')
  44. .notification-content.text-left
  45. block
  46. else if kind === 'danger'
  47. div(
  48. class='notification notification-type-error' + extraClass
  49. hidden
  50. data-ol-custom-form-message=key
  51. role='alert'
  52. aria-live='polite'
  53. )
  54. .notification-icon
  55. +material-symbol('error')
  56. .notification-content.text-left
  57. block
  58. else
  59. div(
  60. class='notification notification-type-warning' + extraClass
  61. hidden
  62. data-ol-custom-form-message=key
  63. role='alert'
  64. aria-live='polite'
  65. )
  66. .notification-icon
  67. +material-symbol('warning')
  68. .notification-content.text-left
  69. block
  70. mixin customValidationMessageNewStyle(key)
  71. .notification.notification-type-error(hidden data-ol-custom-form-message=key)
  72. .notification-icon
  73. +material-symbol('error')
  74. .notification-content.text-left.small
  75. block