overleaf-cep/services/web/app/views/_mixins/formMessages.pug
Rebeka Dekany c40ab3234d Prettier for PUG templates (#26170)
* Setup prettier

* Ignore these pug templates by prettier

* Fix typo

* Fix prettier error

* Add prettier-ignore for quoting of event-segmentation attribute

* Manual tab indentation

* Interpolate

* Remove unbuffered if conditional

* Inline event-segmentation objects and remove prettier-ignore rule

* Fix spacing before interpolation

* Source format

* Source format

GitOrigin-RevId: c30e037f5caf8f91efc1bd9e75f81ae533b5a506
2025-06-24 08:05:06 +00:00

86 lines
2 KiB
Text

include ./material_symbol
mixin formMessages
div(data-ol-form-messages='' role='alert')
mixin formMessagesNewStyle(extraClass = 'form-messages-bottom-margin')
- const attrs = extraClass ? {class: extraClass} : {}
div(data-ol-form-messages-new-style='' role='alert')&attributes(attrs)
mixin customFormMessage(key, kind)
if kind === 'success'
.alert.alert-success(
hidden
data-ol-custom-form-message=key
role='alert'
aria-live='polite'
)
block
else if kind === 'danger'
.alert.alert-danger(
hidden
data-ol-custom-form-message=key
role='alert'
aria-live='assertive'
)
block
else
.alert.alert-warning(
hidden
data-ol-custom-form-message=key
role='alert'
aria-live='polite'
)
block
mixin customFormMessageNewStyle(key, kind, extraClass = 'mb-3')
- extraClass = extraClass ? ' ' + extraClass : ''
if kind === 'success'
div(
class='notification notification-type-success' + extraClass
hidden
data-ol-custom-form-message=key
role='alert'
aria-live='polite'
)
.notification-icon
+material-symbol('check_circle')
.notification-content.text-left
block
else if kind === 'danger'
div(
class='notification notification-type-error' + extraClass
hidden
data-ol-custom-form-message=key
role='alert'
aria-live='polite'
)
.notification-icon
+material-symbol('error')
.notification-content.text-left
block
else
div(
class='notification notification-type-warning' + extraClass
hidden
data-ol-custom-form-message=key
role='alert'
aria-live='polite'
)
.notification-icon
+material-symbol('warning')
.notification-content.text-left
block
mixin customValidationMessage(key)
.invalid-feedback.mt-2(hidden data-ol-custom-form-message=key)
i.fa.fa-fw.fa-warning.me-1(aria-hidden='true')
div
block
mixin customValidationMessageNewStyle(key)
.notification.notification-type-error(hidden data-ol-custom-form-message=key)
.notification-icon
+material-symbol('error')
.notification-content.text-left.small
block