Yu-Gi-Oh! Deck Building and Card Inventory Management web interface written in Common Lisp, utilizing HTMX.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

72 行
2.4KB

  1. #|
  2. This is probably a complete waste of time, but this is a WIDGET class
  3. that encapsulates doing stuff with web widgets.
  4. See the [reblocks Quickstart](https://40ants.com/reblocks/quickstart/) for more information on how this is intended to be structured and used.
  5. There are no guarantees that any of this is sane or useful.
  6. #+BEGIN_SRC
  7. CLASS ztf_handler DEFINITION
  8. TYPES t_sap_tables TYPE STANDARD TABLE OF dd02t WITH EMPTY KEY.
  9. DATA path TYPE string.
  10. DATA searched_string TYPE string.
  11. DATA page TYPE i.
  12. METHODS html_page RETURNING VALUE(html) TYPE string.
  13. METHODS html_shellbar RETURNING VALUE(html) TYPE string.
  14. METHODS html_searchbar RETURNING VALUE(html) TYPE string.
  15. METHODS html_table RETURNING VALUE(html) TYPE string.
  16. METHODS html_table_rows RETURNING VALUE(html) TYPE string.
  17. METHODS sap_table_getcount RETURNING VALUE(count) TYPE i.
  18. METHODS sap_table_getlist RETURNING VALUE(sap_tables) TYPE t_sap_tables.
  19. #+END_SRC
  20. |#
  21. (defpackage #:cl-deck-builder2.web.widget
  22. (:use #:cl
  23. #:caveman2)
  24. (:import-from #:cl-deck-builder2.web
  25. #:render-with-env))
  26. (in-package #:cl-deck-builder2.web.widget)
  27. (defclass widget-base (standard-object)
  28. ((tables :accessor widget-tables
  29. :initarg :tables
  30. :initform '())
  31. ;; Hash table of registered templates. Mapping :PAGE to #P"page.html"
  32. (templates :accessor widget-templates
  33. :initform (make-hash-table)))
  34. (:documentation "The WIDGET-BASE is the base class for other WIDGET objects. We have the minimum info: the environment TABLES and the template PATH."))
  35. (defmethod widget-path ((obj widget-base) tag)
  36. (gethash tag (widget-templates obj)))
  37. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  38. (defmethod html-page ((obj widget-base) tag)
  39. (render-with-env
  40. (widget-path obj tag)
  41. (list (widget-tables obj))))
  42. (defmethod html-shellbar ((obj widget-bells))
  43. (render-with-env (widget-search-path obj)
  44. (list (widget-tables obj))))
  45. (in-package #:cl-deck-builder2.web)
  46. (defparameter *w* (make-instance 'cl-deck-builder2.web.widget::widget-bells
  47. :path #P"workbench/tabs.html"
  48. :search-path #P"workbench/test.html"))
  49. (defroute ("/test" :method :GET) (&key _parsed)
  50. (declare (ignore _parsed))
  51. (cl-deck-builder2.web.widget::html-page *w*))
  52. (defroute ("/test2" :method :GET) (&key _parsed)
  53. (declare (ignore _parsed))
  54. (cl-deck-builder2.web.widget::html-shellbar *w*))