Load sus multi-form from disk

This commit is contained in:
Marcus Kammer 2024-06-15 19:22:21 +02:00
parent 16ad1e6c77
commit 5025d948ab
Signed by: marcuskammer
GPG key ID: C374817BE285268F
3 changed files with 111 additions and 97 deletions

View file

@ -0,0 +1,9 @@
(multi-form
(:ask "How old are you?"
:group "demo-1"
:style "list-style:none;"
:choices (:single "under 18"
"18 to 25"
"26 to 35"
"36 to 45"
"over 45")))

View file

@ -0,0 +1,92 @@
(in-package :ml-survey/views)
(multi-form
(:ask "I would like to use this system frequently."
:group "sus-1"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "The system is unnecessarily complex."
:group "sus-2"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "The system is easy to use."
:group "sus-3"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "I need the support of a technical person to use this system."
:group "sus-4"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "The functions in this system are well integrated."
:group "sus-5"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "There is too much inconsistency in this system."
:group "sus-6"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "Most people would learn to use this system very quickly."
:group "sus-7"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "The system is very awkward to use."
:group "sus-8"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "I feel very confident using this system."
:group "sus-9"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "I needed to learn a lot of things to get started with this system."
:group "sus-10"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree")))

View file

@ -3,116 +3,29 @@
(defun load-form (lang form-file-name) (defun load-form (lang form-file-name)
"Load a Lisp file containing form definitions." "Load a Lisp file containing form definitions."
(let* ((relative-path (concatenate 'string "src/views/forms/" lang "/")) (let* ((relative-path (concatenate 'string "src/views/forms/" lang "/"))
(full-path (merge-pathnames relative-path *default-pathname-defaults*)) (full-path (uiop:merge-pathnames* relative-path (uiop:getcwd)))
(form-path (merge-pathnames form-file-name full-path))) (form-path (uiop:merge-pathnames* form-file-name full-path)))
(unless (probe-file form-path) (unless (probe-file form-path)
(error "Form file ~A does not exist." form-path)) (error "Form file ~A does not exist." form-path))
(load form-path))) (load form-path))
nil)
(defun sus-form-en (survey-id) (defun sus-form-en (survey-id)
(with-page (:title "SUS Form") (with-page (:title "SUS Form")
(navbar-en) (:section :class "container my-5"
(:section :class "container"
(:h2 "Usability Feedback Form") (:h2 "Usability Feedback Form")
(:p "Please fill out the following forms and press the submit button.") (:p "Please fill out the following forms and press the submit button.")
(:form :action (format nil "/survey/~a/questionnaire/sus" survey-id) (:form :action (format nil "/survey/~a/questionnaire/sus" survey-id)
:method "post" :method "post"
:class (dev.metalisp.sbt/utility:spacing :property "m" :side "y" :size 5) :class (dev.metalisp.sbt/utility:spacing :property "m"
(multi-form :side "y"
(:ask "Id like to use this system frequently." :size 5)
:group "sus-1" ;; load the multi-form from disk
:style "list-style:none;" (load-form "en" "sus.lisp")
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "The system is unnecessarily complex."
:group "sus-2"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "The system is easy to use."
:group "sus-3"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "I need the support of a technical person to use this system."
:group "sus-4"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "The functions in this system are well integrated."
:group "sus-5"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "There is too much inconsistency in this system."
:group "sus-6"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "Most people would learn to use this system very quickly."
:group "sus-7"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "The system is very awkward to use."
:group "sus-8"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "I feel very confident using this system."
:group "sus-9"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree"))
(:ask "I needed to learn a lot of things to get started with this system."
:group "sus-10"
:style "list-style:none;"
:choices (:single "1 Strongly Disagree"
"2 Disagree"
"3 Neither Agree nor Disagree"
"4 Agree"
"5 Strongly Agree")))
(btn-primary (:type "submit") (btn-primary (:type "submit")
(find-l10n "submit" *html-lang* *l10n*)))))) (find-l10n "submit" *html-lang* *l10n*))))))
(defun sus-form-de (survey-id) (defun sus-form-de (survey-id)
(with-page (:title "SUS Formular") (with-page (:title "SUS Formular")
(navbar-de) (navbar-de)