From 331fd70b31b64da6614216b91856c08fdfa6ffc9 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Mon, 5 Feb 2024 18:34:46 +0100 Subject: [PATCH 1/9] Update file meta data --- src/component/accordion.lisp | 6 ++---- src/main.lisp | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/component/accordion.lisp b/src/component/accordion.lisp index 3c31532..6a0c0fb 100644 --- a/src/component/accordion.lisp +++ b/src/component/accordion.lisp @@ -1,8 +1,6 @@ +;;;; -*- mode: lisp; coding: utf-8; tab-width: 4; fill-column: 100; indent-tabs-mode: nil; -*- ;;;; accordion.lisp -;;;; -;;;; This file defines a package for generating Bootstrap accordion components -;;;; using Common Lisp macros. - +;;;; This file defines a package for generating Bootstrap accordion components using Common Lisp macros. (defpackage dev.metalisp.sbt/component/accordion (:documentation "A package for generating Bootstrap accordions.") (:use :cl) diff --git a/src/main.lisp b/src/main.lisp index 4ef89ce..ec742a9 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -1,6 +1,6 @@ ;;;; -*- mode: lisp; coding: utf-8; tab-width: 4; fill-column: 100; indent-tabs-mode: nil; -*- -;;;; main - Provide general functions. - +;;;; main.lisp +;;;; Provide general functions. (defpackage dev.metalisp.sbt (:use :cl) (:export From 567ab6ae2988552064e49c4127c666348e836335 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Sat, 10 Feb 2024 13:38:57 +0100 Subject: [PATCH 2/9] Update questionnaire docs --- docs/pattern/questionnaire.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pattern/questionnaire.org b/docs/pattern/questionnaire.org index 416c640..aa4abc2 100644 --- a/docs/pattern/questionnaire.org +++ b/docs/pattern/questionnaire.org @@ -1,7 +1,7 @@ #+title: Creating a Questionnaire using cl-sbt/questionnaire Macros in a Web Application #+author: Marcus Kammer #+email: marcus.kammer@mailbox.org -#+date: 2024-02-04T13:11+01:00 +#+date: 2024-02-10T12:45+01:00 * Introduction Questionnaires are powerful tools for gathering information and insights from @@ -22,7 +22,7 @@ like single-choice, multiple-choice, or open-ended questions. - Multiple Choice: Questions that allow multiple answers. - Text: Open-ended questions for free text input. -* Integrating cl-sbt/questionnaire Macros +* Integrating dev.metalisp.sbt/component/questionnaire Macros To create a questionnaire in your Common Lisp web application, cl-sbt/questionnaire macros can be employed. These macros generate the HTML From 4c0e530c9eafc86a75eaa0de8b2791326df3bb8f Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Sat, 10 Feb 2024 13:39:15 +0100 Subject: [PATCH 3/9] Add survey example --- .../pattern/survey-examples/user-research.org | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 docs/pattern/survey-examples/user-research.org diff --git a/docs/pattern/survey-examples/user-research.org b/docs/pattern/survey-examples/user-research.org new file mode 100644 index 0000000..3b7c83a --- /dev/null +++ b/docs/pattern/survey-examples/user-research.org @@ -0,0 +1,45 @@ +#+name: survey-page +#+begin_src lisp :results output file :file-ext html + (defpackage survey-app + (:use :cl) + (:import-from :dev.metalisp.sbt :with-page) + (:import-from :dev.metalisp.sbt/pattern/questionnaire :questionnaire) + (:export :generate-survey-page)) + + (in-package :survey-app) + + (defun generate-survey-page () + "Generates an HTML page with questionnaires using questionnaire macros." + (with-output-to-string (spinneret:*html*) + (with-page (:title "Product Experience" :main-con t) + (questionnaire "/submit" + (:ask "What is your age range?" + :group "demo-age-range" + :choices (:single "18-24" "25-34" "35-44" "45-54" "55+")) + (:ask "What is your gender?" + :group "demo-gender" + :choices (:single "Male" "Female" "Non-binary" "Prefer not to say" "Other" :text "Other")) + (:ask "What is your profession?" + :group "demo-profession" + :choices (:text "Profession")) + (:ask "How often do you use our software?" + :group "behave-useage" + :choices (:single "Daily" "Weekly" "Monthly" "Less frequently")) + (:ask "What features do you use the most?" + :group "behave-features" + :choices (:multiple "Bookmarks" "Dashboard")) + (:ask "Have you used our software for a long period of time?" + :group "behave-period" + :choices (:single "Less than 1 month" "1-3 months" "3-6 months" "6-12 months" "1-2 years" "More than 2 years")) + (:ask "What is your preferred method of payment for online purchases?" + :group "payment" + :choices (:radio "Credit/Debit Card" "PayPal" "Bank Transfer" "Cash on Delivery" "Cryptocurrency")) + (:ask "Which social media platforms do you use regularly?" + :group "socialmedia" + :choices (:checkbox "Facebook" "Twitter" "Instagram" "LinkedIn" "TikTok" "None" :text "Other")) + (:ask "How do you usually consume news?" + :group "newsconsumption" + :choices (:radio "Online News Websites" "Social Media" "Television" "Newspapers/Magazines" "Radio" "None")))))) + + (format t (generate-questionnaire-page)) +#+end_src From 49c292ccd1427a54e7a1e9bef9d2e35273675db7 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Sat, 10 Feb 2024 19:52:54 +0100 Subject: [PATCH 4/9] Fix function name --- docs/pattern/survey-examples/user-research.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/pattern/survey-examples/user-research.org b/docs/pattern/survey-examples/user-research.org index 3b7c83a..f4b4a90 100644 --- a/docs/pattern/survey-examples/user-research.org +++ b/docs/pattern/survey-examples/user-research.org @@ -41,5 +41,8 @@ :group "newsconsumption" :choices (:radio "Online News Websites" "Social Media" "Television" "Newspapers/Magazines" "Radio" "None")))))) - (format t (generate-questionnaire-page)) + (format t (generate-survey-page)) #+end_src + +#+RESULTS: survey-page +[[file:survey-page.html]] From 380c1ccc538ad6729fd41a3b8a82d642d2167878 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Sun, 11 Feb 2024 12:34:21 +0100 Subject: [PATCH 5/9] Split survey in smaller parts --- .../pattern/survey-examples/user-research.org | 126 ++++++++++++++---- 1 file changed, 97 insertions(+), 29 deletions(-) diff --git a/docs/pattern/survey-examples/user-research.org b/docs/pattern/survey-examples/user-research.org index f4b4a90..7c44d01 100644 --- a/docs/pattern/survey-examples/user-research.org +++ b/docs/pattern/survey-examples/user-research.org @@ -1,17 +1,25 @@ -#+name: survey-page -#+begin_src lisp :results output file :file-ext html - (defpackage survey-app +* Create lisp package + +#+begin_src lisp + (defpackage user-research-app (:use :cl) (:import-from :dev.metalisp.sbt :with-page) - (:import-from :dev.metalisp.sbt/pattern/questionnaire :questionnaire) - (:export :generate-survey-page)) + (:import-from :dev.metalisp.sbt/pattern/questionnaire :questionnaire)) +#+end_src - (in-package :survey-app) +#+RESULTS: +: # - (defun generate-survey-page () +* Demographics + +#+name: demographics-survey +#+begin_src lisp :results output file :file-ext html + (in-package :user-research-app) + + (defun generate-demographics-survey () "Generates an HTML page with questionnaires using questionnaire macros." (with-output-to-string (spinneret:*html*) - (with-page (:title "Product Experience" :main-con t) + (with-page (:title "Product Experience Survey" :main-con t) (questionnaire "/submit" (:ask "What is your age range?" :group "demo-age-range" @@ -22,27 +30,87 @@ (:ask "What is your profession?" :group "demo-profession" :choices (:text "Profession")) - (:ask "How often do you use our software?" - :group "behave-useage" - :choices (:single "Daily" "Weekly" "Monthly" "Less frequently")) - (:ask "What features do you use the most?" - :group "behave-features" - :choices (:multiple "Bookmarks" "Dashboard")) - (:ask "Have you used our software for a long period of time?" - :group "behave-period" - :choices (:single "Less than 1 month" "1-3 months" "3-6 months" "6-12 months" "1-2 years" "More than 2 years")) - (:ask "What is your preferred method of payment for online purchases?" - :group "payment" - :choices (:radio "Credit/Debit Card" "PayPal" "Bank Transfer" "Cash on Delivery" "Cryptocurrency")) - (:ask "Which social media platforms do you use regularly?" - :group "socialmedia" - :choices (:checkbox "Facebook" "Twitter" "Instagram" "LinkedIn" "TikTok" "None" :text "Other")) - (:ask "How do you usually consume news?" - :group "newsconsumption" - :choices (:radio "Online News Websites" "Social Media" "Television" "Newspapers/Magazines" "Radio" "None")))))) + (:ask "What is your educational background?" + :group "demo-edu" + :choices (:text "Last Degree")))))) - (format t (generate-survey-page)) + (format t (generate-demographics-survey)) #+end_src -#+RESULTS: survey-page -[[file:survey-page.html]] +#+RESULTS: demographics-survey +[[file:demographics-survey.html]] + +* Geographics + +#+name: geographics-survey +#+begin_src lisp :results output file :file-ext html + (in-package :user-research-app) + + (defun generate-geographics-survey () + "Generates an HTML page with questionnaires using questionnaire macros." + (with-output-to-string (spinneret:*html*) + (with-page (:title "Product Experience Survey" :main-con t) + (questionnaire "/submit" + (:ask "Where are you located?" + :group "geo-loca" + :choices (:text "Country")) + (:ask "Which timezone do you operate in?" + :group "geo-timezone" + :choices (:text "Timezone")))))) + + (format t (generate-geographics-survey)) +#+end_src + +#+RESULTS: geographics-survey +[[file:geographics-survey.html]] + +* Behavioral + +#+name: behavioral-survey +#+begin_src lisp :results output file :file-ext html + (in-package :user-research-app) + + (defun generate-behavioral-survey () + "Generates an HTML page with questionnaires using questionnaire macros." + (with-output-to-string (spinneret:*html*) + (with-page (:title "Product Experience Survey" :main-con t) + (questionnaire "/submit" + (:ask "How often do you use our software?" + :group "beh-useage" + :choices (:single "Daily" "Weekly" "Monthly" "Less frequently")) + (:ask "What features do you use the most?" + :group "beh-feature" + :choices (:multiple "Bookmarks" "KPI" "Contacts")) + (:ask "Have you used our software for along period of time?" + :group "beh-longuse" + :choices (:single "Yes" "No")))))) + + (format t (generate-behavioral-survey)) +#+end_src + +#+RESULTS: behavioral-survey +[[file:behavioral-survey.html]] + +* Psychographics + +#+name: psychographics-survey +#+begin_src lisp :results output file :file-ext html + (in-package :user-research-app) + + (defun generate-psychographics-survey () + "Generates an HTML page with questionnaires using questionnaire macros." + (with-output-to-string (spinneret:*html*) + (with-page (:title "Product Experience Survey" :main-con t) + (questionnaire "/submit" + (:ask "What do you value most in our software?" + :group "psy-value" + :choices (:text "Most value")) + (:ask "What motivates you to use our software?" + :group "psy-motivate" + :choices (:text "Your motivation")))))) + + (format t (generate-psychographics-survey)) +#+end_src + +#+RESULTS: psychographics-survey +[[file:psychographics-survey.html]] From b2ff3dc228395d9d413921f76b054923ff2e4168 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Sun, 11 Feb 2024 12:35:00 +0100 Subject: [PATCH 6/9] Add html for survey --- .../survey-examples/behavioral-survey.html | 110 +++++++++++++ .../survey-examples/demographics-survey.html | 148 ++++++++++++++++++ .../survey-examples/geographics-survey.html | 47 ++++++ .../psychographics-survey.html | 48 ++++++ 4 files changed, 353 insertions(+) create mode 100644 docs/pattern/survey-examples/behavioral-survey.html create mode 100644 docs/pattern/survey-examples/demographics-survey.html create mode 100644 docs/pattern/survey-examples/geographics-survey.html create mode 100644 docs/pattern/survey-examples/psychographics-survey.html diff --git a/docs/pattern/survey-examples/behavioral-survey.html b/docs/pattern/survey-examples/behavioral-survey.html new file mode 100644 index 0000000..9c59999 --- /dev/null +++ b/docs/pattern/survey-examples/behavioral-survey.html @@ -0,0 +1,110 @@ + + + + + + Product Experience Survey + + + +

Product Experience Survey

+
+
+
+ How often do you use our software? +
    +
  1. + +
    + +
    +
  2. + +
    + +
    +
  3. + +
    + +
    +
  4. + +
    + +
    +
+
+
+
+ What features do you use the most? +
    +
  1. + +
    + +
    +
  2. + +
    + +
    +
  3. + +
    + +
    +
+
+
+
+ Have you used our software for along period of time? +
    +
  1. + +
    + +
    +
  2. + +
    + +
    +
+
+
+ +
+
+ + + \ No newline at end of file diff --git a/docs/pattern/survey-examples/demographics-survey.html b/docs/pattern/survey-examples/demographics-survey.html new file mode 100644 index 0000000..0c37385 --- /dev/null +++ b/docs/pattern/survey-examples/demographics-survey.html @@ -0,0 +1,148 @@ + + + + + + Product Experience Survey + + + +

Product Experience Survey

+
+
+
+ What is your age range? +
    +
  1. + +
    + +
    +
  2. + +
    + +
    +
  3. + +
    + +
    +
  4. + +
    + +
    +
  5. + +
    + +
    +
+
+
+
+ What is your gender? +
    +
  1. + +
    + +
    +
  2. + +
    + +
    +
  3. + +
    + +
    +
  4. + +
    + +
    +
  5. + +
    + +
    +
  6. + +
    + + +
    +
+
+
+
+ What is your profession? +
    +
  1. + +
    + + +
    +
+
+
+
+ What is your educational background? +
    +
  1. + +
    + + +
    +
+
+
+ +
+
+ + + \ No newline at end of file diff --git a/docs/pattern/survey-examples/geographics-survey.html b/docs/pattern/survey-examples/geographics-survey.html new file mode 100644 index 0000000..077b46c --- /dev/null +++ b/docs/pattern/survey-examples/geographics-survey.html @@ -0,0 +1,47 @@ + + + + + + Product Experience Survey + + + +

Product Experience Survey

+
+
+
+ Where are you located? +
    +
  1. + +
    + + +
    +
+
+
+
+ Which timezone do you operate in? +
    +
  1. + +
    + + +
    +
+
+
+ +
+
+ + + \ No newline at end of file diff --git a/docs/pattern/survey-examples/psychographics-survey.html b/docs/pattern/survey-examples/psychographics-survey.html new file mode 100644 index 0000000..e440713 --- /dev/null +++ b/docs/pattern/survey-examples/psychographics-survey.html @@ -0,0 +1,48 @@ + + + + + + Product Experience Survey + + + +

Product Experience Survey

+
+
+
+ What do you value most in our software? +
    +
  1. + +
    + + +
    +
+
+
+
+ What motivates you to use our software? +
    +
  1. + +
    + + +
    +
+
+
+ +
+
+ + + \ No newline at end of file From 6dc6865405c0105109da17eb57e9c5bf3c7980ac Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Sun, 11 Feb 2024 13:32:43 +0100 Subject: [PATCH 7/9] Update surveys docs --- .../pattern/survey-examples/user-research.org | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/docs/pattern/survey-examples/user-research.org b/docs/pattern/survey-examples/user-research.org index 7c44d01..d73623e 100644 --- a/docs/pattern/survey-examples/user-research.org +++ b/docs/pattern/survey-examples/user-research.org @@ -114,3 +114,51 @@ #+RESULTS: psychographics-survey [[file:psychographics-survey.html]] + +* Needs/Challenges + +#+name: nc-survey +#+begin_src lisp :results output file :file-ext html + (in-package :user-research-app) + + (defun generate-nc-survey () + "Generates an HTML page with questionnaires using questionnaire macros." + (with-output-to-string (spinneret:*html*) + (with-page (:title "Product Experience Survey" :main-con t) + (questionnaire "/submit" + (:ask "What challenges, if any, does our software help you overcome?" + :group "nc-challenges" + :choices (:text "Please describe")) + (:ask "How could we improve to better meet your needs?" + :group "nc-improve" + :choices (:single "Please describe")))))) + + (format t (generate-nc-survey)) +#+end_src + +#+RESULTS: nc-survey +[[file:nc-survey.html]] + +* Technology Comfort Level + +#+name: tcl-survey +#+begin_src lisp :results output file :file-ext html + (in-package :user-research-app) + + (defun generate-tcl-survey () + "Generates an HTML page with questionnaires using questionnaire macros." + (with-output-to-string (spinneret:*html*) + (with-page (:title "Product Experience Survey" :main-con t) + (questionnaire "/submit" + (:ask "How would you rate your comfort level with technology?" + :group "tcl-likeart" + :choices (:single "1 - Very Uncomfortable" "2 - Slightly Uncomfortable" "3 - Neutral" "4 - Quite Comfortable" "5 - Very Comfortable")) + (:ask "How frequently do you adopt new technologies?" + :group "tcl-adopt" + :choices (:single "1 - Always - I'm an early adopter." "2 - Often - I stay on top of technological advances and adopt them frequently." "3 - Sometimes - I adopt new technologies now and then." "4 - Rarely - I only adopt new technologies when it's necessary for work or other important tasks." "5 - Never - I avoid adopting new technologies unless absolutely required.")))))) + + (format t (generate-tcl-survey)) +#+end_src + +#+RESULTS: tcl-survey +[[file:tcl-survey.html]] From 373ca10b34a595ff9976dde3dea93354b8f01e97 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Sun, 11 Feb 2024 13:32:53 +0100 Subject: [PATCH 8/9] Add example survey html --- docs/pattern/survey-examples/nc-survey.html | 48 +++++++ docs/pattern/survey-examples/tcl-survey.html | 124 +++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 docs/pattern/survey-examples/nc-survey.html create mode 100644 docs/pattern/survey-examples/tcl-survey.html diff --git a/docs/pattern/survey-examples/nc-survey.html b/docs/pattern/survey-examples/nc-survey.html new file mode 100644 index 0000000..8365315 --- /dev/null +++ b/docs/pattern/survey-examples/nc-survey.html @@ -0,0 +1,48 @@ + + + + + + Product Experience Survey + + + +

Product Experience Survey

+
+
+
+ What challenges, if any, does our software help you overcome? +
    +
  1. + +
    + + +
    +
+
+
+
+ How could we improve to better meet your needs? +
    +
  1. + +
    + +
    +
+
+
+ +
+
+ + + \ No newline at end of file diff --git a/docs/pattern/survey-examples/tcl-survey.html b/docs/pattern/survey-examples/tcl-survey.html new file mode 100644 index 0000000..81a46af --- /dev/null +++ b/docs/pattern/survey-examples/tcl-survey.html @@ -0,0 +1,124 @@ + + + + + + Product Experience Survey + + + +

Product Experience Survey

+
+
+
+ How would you rate your comfort level with technology? +
    +
  1. + +
    + +
    +
  2. + +
    + +
    +
  3. + +
    + +
    +
  4. + +
    + +
    +
  5. + +
    + +
    +
+
+
+
+ How frequently do you adopt new technologies? +
    +
  1. + +
    + +
    +
  2. + +
    + +
    +
  3. + +
    + +
    +
  4. + +
    + +
    +
  5. + +
    + +
    +
+
+
+ +
+
+ + + \ No newline at end of file From ee60c00d7834da9de217869774bf6a83433af524 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Sun, 11 Feb 2024 19:52:07 +0100 Subject: [PATCH 9/9] Choose the first element in list using nth instead of cadr --- src/pattern/questionnaire.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pattern/questionnaire.lisp b/src/pattern/questionnaire.lisp index 9c011e5..7dc80e9 100644 --- a/src/pattern/questionnaire.lisp +++ b/src/pattern/questionnaire.lisp @@ -253,7 +253,7 @@ Returns multiple values: - The group name (GROUP) - The choices (CHOICES)" (let ((splitted-list (split-list-by-keyword question))) - (apply #'values (mapcar (lambda (x) (cadr x)) splitted-list)))) + (apply #'values (mapcar (lambda (x) (nth 1 x)) splitted-list)))) (defmacro questionnaire (action &body body) "This macro generates an HTML form composed of multiple questions, each rendered using the `question' macro.