Fix naming
This commit is contained in:
parent
9f5aa8ae70
commit
3293324065
1 changed files with 9 additions and 10 deletions
|
@ -133,7 +133,7 @@ Example:
|
||||||
:aria-label "Search")
|
:aria-label "Search")
|
||||||
(btn-outline-success (:type "submit") "Search"))))
|
(btn-outline-success (:type "submit") "Search"))))
|
||||||
|
|
||||||
(defmacro answer (text name type)
|
(defmacro choice (text name type)
|
||||||
"This macro generates a list item for an answer option in a question.
|
"This macro generates a list item for an answer option in a question.
|
||||||
|
|
||||||
TEXT: The display text of the answer option.
|
TEXT: The display text of the answer option.
|
||||||
|
@ -150,7 +150,7 @@ Example usage:
|
||||||
(:input :type ,type :name ,name)
|
(:input :type ,type :name ,name)
|
||||||
,text))))
|
,text))))
|
||||||
|
|
||||||
(defmacro question (question (&key (group "group") (type "radio")) &rest rest)
|
(defmacro question (question (&key (group "group") (type "radio")) &rest choices)
|
||||||
"This macro generates a fieldset for a question with multiple answers.
|
"This macro generates a fieldset for a question with multiple answers.
|
||||||
|
|
||||||
QUESTION: The text of the question to be displayed in the legend.
|
QUESTION: The text of the question to be displayed in the legend.
|
||||||
|
@ -161,7 +161,7 @@ string.
|
||||||
TYPE: Specifies the type of input elements. Commonly used value is \"radio\".
|
TYPE: Specifies the type of input elements. Commonly used value is \"radio\".
|
||||||
Defaults to an empty string.
|
Defaults to an empty string.
|
||||||
|
|
||||||
REST: A list of strings representing the different answers available for
|
CHOICES: A list of strings representing the different answers available for
|
||||||
selection.
|
selection.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
@ -169,8 +169,8 @@ Example:
|
||||||
(:group \"age\" :type \"radio\") \"18-24\" \"25-34\" \"35-44\")"
|
(:group \"age\" :type \"radio\") \"18-24\" \"25-34\" \"35-44\")"
|
||||||
`(spinneret:with-html
|
`(spinneret:with-html
|
||||||
(:fieldset (:legend ,question)
|
(:fieldset (:legend ,question)
|
||||||
(:ol ,@(loop for text in rest
|
(:ol ,@(loop for text in choices
|
||||||
collect `(answer ,text ,group ,type))))))
|
collect `(choice ,text ,group ,type))))))
|
||||||
|
|
||||||
(defmacro questionnaire (action &body body)
|
(defmacro questionnaire (action &body body)
|
||||||
"This macro generates an HTML form composed of multiple questions, each
|
"This macro generates an HTML form composed of multiple questions, each
|
||||||
|
@ -202,13 +202,12 @@ QUESTIONS: A series of plists, each representing a question. Each plist should
|
||||||
contain the keys :question, :name, :type, and :answers.
|
contain the keys :question, :name, :type, and :answers.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
(questionnaire \"/submit\" (:ask \"How old are you?\" :group \"age\" :type \"radio\" :answers (\"18-24\" \"25-34\" \"35-44\")))
|
(questionnaire \"/submit\"
|
||||||
|
(:ask \"How old are you?\" :group \"age\" :type \"radio\" :choices (\"18-24\" \"25-34\" \"35-44\")))"
|
||||||
This will create a form with a question and radio button options, and a Submit button."
|
|
||||||
`(spinneret:with-html
|
`(spinneret:with-html
|
||||||
(:form :action ,action
|
(:form :action ,action
|
||||||
:method "post"
|
:method "post"
|
||||||
,@(loop for q in questions
|
,@(loop for q in questions
|
||||||
collect (destructuring-bind (&key ask group type answers) q
|
collect (destructuring-bind (&key ask group type choices) q
|
||||||
`(question ,ask (:group ,group :type ,type) ,@answers)))
|
`(question ,ask (:group ,group :type ,type) ,@choices)))
|
||||||
(btn-primary (:type "submit") "Submit"))))
|
(btn-primary (:type "submit") "Submit"))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue