Fix multi-action form.
[clinton/lisp-on-lines.git] / src / ucw / standard-components.lisp
... / ...
CommitLineData
1(in-package :lisp-on-lines-ucw)
2
3(defclass described-component-class (standard-component-class described-class)
4 ())
5
6(defmacro defaction (&rest args-and-body)
7 `(arnesi:defmethod/cc ,@args-and-body))
8
9(defun make-action (lambda &rest args)
10 (let ((ucw::*default-action-class* 'basic-action))
11 (apply #'ucw::make-action lambda args)))
12
13(defclass standard-application (ucw:basic-application)
14 ())
15
16(defclass standard-request-context (ucw::standard-request-context)
17 ())
18
19(defmethod ucw:request-context-class list ((application standard-application))
20 'standard-request-context)
21
22(defvar +action-compound-name-delimiter+ #\|)
23
24(defmethod ucw::find-action-id :around ((context standard-request-context))
25 (or
26 (loop
27
28 :for (k . v) in (ucw::parameters
29 (context.request context))
30 :do(destructuring-bind (param-name &optional action-id)
31 (split-sequence:split-sequence
32 +action-compound-name-delimiter+ k)
33 (when (and action-id
34 (string=
35 ucw::+action-parameter-name+ param-name))
36 (return action-id))))
37 (call-next-method)))
38
39(defcomponent standard-window-component
40 (ucw:basic-window-component)
41 ((body
42 :initform nil
43 :accessor window-body
44 :component t
45 :initarg :body)))
46
47(defmethod render-html-body ((window standard-window-component))
48 (ucw:render (window-body window)))