/examples/weblocks-elephant-demo/src/layout.lisp

https://bitbucket.org/skypher/weblocks-stable/ · Lisp · 58 lines · 52 code · 6 blank · 0 comment · 4 complexity · 1617d6f5fcdf5462954119aa18464ba1 MD5 · raw file

  1. (in-package :weblocks-elephant-demo)
  2. (defun initial-page (k)
  3. "Initial page is so simple we can just define a function to render
  4. it and use it as a widget. Since it will be used in a continuation
  5. flow, it accepts K - the continuation parameter."
  6. (with-html
  7. (:div :style "text-align: center; margin-top: 25em;"
  8. (:p :style "font-style: italic;"
  9. "Roses are red," (:br)
  10. "Violets are blue," (:br)
  11. (:a :href "http://en.wikipedia.org/wiki/Steve_Russell" "Steve Russell") " rocks," (:br)
  12. "Homage to you!" (:br))
  13. (render-link (lambda (&rest args)
  14. (declare (ignore args))
  15. (answer k))
  16. "Next"
  17. :ajaxp nil))))
  18. (defun make-main-page ()
  19. "Lays out the main page. It consists of a FLASH widget for showing
  20. initial message, and a NAVIGATION widget with panes that hold
  21. employees page and companies page."
  22. (make-instance 'composite :widgets
  23. (list
  24. (make-instance 'flash :messages
  25. (list "Welcome to weblocks demo - a
  26. technology demonstration for a
  27. continuations-based web
  28. framework written in Common
  29. Lisp."))
  30. (make-navigation 'main-menu
  31. 'employees (make-employees-page)
  32. 'companies (make-companies-page)))))
  33. (defun make-employees-page ()
  34. "Lays out the widgets for the employees page. It consists of a
  35. single GRIDEDIT widget."
  36. (make-instance 'composite :widgets
  37. (list
  38. (make-instance 'gridedit
  39. :name 'employees-list
  40. :view 'employee-table-view
  41. :item-form-view 'employee-form-view
  42. :data-class 'employee))))
  43. (defun make-companies-page ()
  44. "Lays out the widgets for the companies page. It consists of a
  45. single GRIDEDIT widget."
  46. (make-instance 'composite :widgets
  47. (list
  48. (make-instance 'gridedit
  49. :name 'companies-grid
  50. :data-class 'company
  51. :view 'company-table-view
  52. :item-form-view 'company-form-view))))