Create the survey package

This commit is contained in:
Marcus Kammer 2025-02-15 12:29:29 +01:00
parent 08462193f6
commit 9aa48638b6
Signed by: marcuskammer
GPG key ID: C374817BE285268F
4 changed files with 48 additions and 42 deletions

View file

@ -2,7 +2,7 @@
(defsystem "dev.metalisp.survey"
:description "Create questionnaires and analyze the results."
:version "0.5.13"
:version "0.5.14"
:author "Marcus Kammer <marcus.kammer@mailbox.org>"
:source-control (:git "https://code.metalisp.dev/marcuskammer/dev.metalisp.survey.git")
:licence "MIT"
@ -15,7 +15,12 @@
:components ((:file "package")
(:file "survey")
(:file "questionnaire")))
(:file "survey")
(:module "survey/"
:depends-on ("models/")
:serial t
:components ((:file "package")
(:file "view")
(:file "handler")))
(:module "questionnaire/"
:depends-on ("models/")
:serial t

View file

@ -1,45 +1,6 @@
;;;; -*- mode: common-lisp; coding: utf-8; -*-
(defpackage ml-survey/survey
(:use #:cl #:ml-survey/models)
(:import-from #:hunchentoot
#:define-easy-handler)
(:import-from #:ml-sbt/section
#:with-section
#:with-section-col
#:with-section-row
#:with-section-props
#:with-title-bar)
(:import-from #:ml-sbt/navbar
#:with-navbar)
(:import-from #:ml-sbt
#:with-page
#:with-body-header
#:with-body-main)
(:import-from #:ml-qmetrics/assessment
#:assessment-html
#:parse-assessments))
;;; -*- mode: lisp; coding: utf-8; -*-
(in-package :ml-survey/survey)
(defun view (survey &optional assessments)
"Generates the view to show the survey created."
(check-type survey survey)
(let ((lang "en"))
(with-page (:title "Survey Details")
(with-body-header "fluid" "Survey Details" lang
(with-navbar "fluid" "metalisp.survey" "/" "Home"
"Home" "/" "New Survey" "/new-survey"))
(with-body-main "fluid"
(:div :class "row"
(with-section-props (with-title-bar "Properties")
(:p (format nil "ID: ~a" (survey-id survey)))
(survey-html survey))
(with-section-col (with-title-bar "Assesments")
(loop for assessment in assessments
when assessments
do (assessment-html assessment (survey-id survey)))))))))
(defstruct questionnaire-response
type
name

20
src/survey/package.lisp Normal file
View file

@ -0,0 +1,20 @@
;;; -*- mode: lisp; coding: utf-8; -*-
(defpackage :ml-survey/survey
(:use #:cl #:ml-survey/models)
(:import-from #:hunchentoot
#:define-easy-handler)
(:import-from #:ml-sbt/section
#:with-section
#:with-section-col
#:with-section-row
#:with-section-props
#:with-title-bar)
(:import-from #:ml-sbt/navbar
#:with-navbar)
(:import-from #:ml-sbt
#:with-page
#:with-body-header
#:with-body-main)
(:import-from #:ml-qmetrics/assessment
#:assessment-html
#:parse-assessments))

20
src/survey/view.lisp Normal file
View file

@ -0,0 +1,20 @@
;;; -*- mode: lisp; coding: utf-8; -*-
(in-package :ml-survey/survey)
(defun view (survey &optional assessments)
"Generates the view to show the survey created."
(check-type survey survey)
(let ((lang "en"))
(with-page (:title "Survey Details")
(with-body-header "fluid" "Survey Details" lang
(with-navbar "fluid" "metalisp.survey" "/" "Home"
"Home" "/" "New Survey" "/new-survey"))
(with-body-main "fluid"
(:div :class "row"
(with-section-props (with-title-bar "Properties")
(:p (format nil "ID: ~a" (survey-id survey)))
(survey-html survey))
(with-section-col (with-title-bar "Assesments")
(loop for assessment in assessments
when assessments
do (assessment-html assessment (survey-id survey)))))))))