Create module/package surveys

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

View file

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

11
src/surveys/handler.lisp Normal file
View file

@ -0,0 +1,11 @@
;;; -*- mode: lisp; coding: utf-8; -*-
(in-package :ml-survey/surveys)
(defun list-of-surveys ()
(mapcar (lambda (x)
(make-instance 'survey
:id (first x)))
(ml-survey/fileops:surveys-db)))
(define-easy-handler (surveys-handler :uri "/") nil
(view (list-of-surveys)))

16
src/surveys/package.lisp Normal file
View file

@ -0,0 +1,16 @@
;;; -*- mode: lisp; coding: utf-8; -*-
(defpackage :ml-survey/surveys
(:use #:cl #:ml-survey/models)
(:import-from #:hunchentoot
#:define-easy-handler)
(:import-from #:ml-sbt/navbar
#:with-navbar)
(:import-from #:ml-sbt/section
#:with-section
#:with-title-bar)
(:import-from #:ml-sbt/btn
#:btn)
(:import-from #:ml-sbt
#:with-body-header
#:with-body-main
#:with-page))

View file

@ -1,21 +1,4 @@
;;;; -*- mode: common-lisp; coding: utf-8; -*-
(defpackage ml-survey/surveys
(:use #:cl #:ml-survey/models)
(:import-from #:hunchentoot
#:define-easy-handler)
(:import-from #:ml-sbt/navbar
#:with-navbar)
(:import-from #:ml-sbt/section
#:with-section
#:with-title-bar)
(:import-from #:ml-sbt/btn
#:btn)
(:import-from #:ml-sbt
#:with-body-header
#:with-body-main
#:with-page))
;;; -*- mode: lisp; coding: utf-8; -*-
(in-package :ml-survey/surveys)
(defparameter *html-lang* "en")
@ -54,12 +37,3 @@ SURVEYS: List of survey objects."
(if description
(:span description)
nil)))))))))))
(defun list-of-surveys ()
(mapcar (lambda (x)
(make-instance 'survey
:id (first x)))
(ml-survey/fileops:surveys-db)))
(define-easy-handler (surveys-handler :uri "/") nil
(view (list-of-surveys)))