Yu-Gi-Oh! Deck Building and Card Inventory Management web interface written in Common Lisp, utilizing HTMX.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

50 wiersze
1.4KB

  1. (in-package #:cl-deck-builder2.web.flash-message)
  2. (defvar *flash-messages* '())
  3. (defclass flash-message ()
  4. ((body :accessor flash-body-of
  5. :initarg :body)
  6. (class :accessor flash-class-of
  7. :initarg :class)
  8. (title :accessor flash-title-of
  9. :initarg :title)))
  10. (defun flash (class title body)
  11. "Essentially HASH-TABLE-PUSH: helper function to PUSHNEW a VALUE associated with KEY to *SESSION* HASH-TABLE."
  12. (let ((obj (make-instance 'flash-message
  13. :class class
  14. :title title
  15. :body body)))
  16. (push obj *flash-messages*)
  17. (flash-body-of obj)))
  18. (defun flash-gethash ()
  19. (let ((messages *flash-messages*))
  20. (setf *flash-messages* '())
  21. (reverse messages)))
  22. ;; error -> is-danger
  23. (defun flash-error (msg)
  24. (flash "is-danger" "Error" (princ-to-string msg)))
  25. ;; message -> is-success
  26. (defun flash-message (msg)
  27. (flash "is-success" "Success" (princ-to-string msg)))
  28. ;; info -> is-info
  29. (defun flash-info (title msg)
  30. (flash "is-info" title (princ-to-string msg)))
  31. ;; link -> is-link
  32. (defun flash-link (title msg)
  33. (flash "is-link" title (princ-to-string msg)))
  34. ;; primary -> is-primary
  35. (defun flash-primary (title msg)
  36. (flash "is-primary" title (princ-to-string msg)))
  37. ;; warning -> is-warning
  38. (defun flash-warning (msg)
  39. (flash "is-warning" "warning" (princ-to-string msg)))