From bb3415ae5c9e358229b84e1f12459561865d65c1 Mon Sep 17 00:00:00 2001 From: Marcus Kammer Date: Mon, 4 Sep 2023 14:22:23 +0200 Subject: [PATCH] Optimize cpu usage and fix naming --- src/component/form.lisp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/component/form.lisp b/src/component/form.lisp index 0a676d2..d4b28f3 100644 --- a/src/component/form.lisp +++ b/src/component/form.lisp @@ -25,17 +25,18 @@ ("search" ("en" "Search" "de" "Suchen" "fr" "Cherchent"))))) (cadr (member lang (cadr (assoc key l10n :test #'string=)) :test #'string=)))) -(defun clean-value-str (str) +(defun clean-value-prop-str (str) "Clean STR to better fit to the value property of a input element" - (substitute #\_ #\- (substitute #\_ #\Space (string-trim '(#\Space) str)))) + (substitute #\_ #\- (substitute #\_ #\Space str))) (defun checkable (type name value) - (let ((name-str (concatenate 'string "group-" name)) - (value-str (clean-value-str value))) + (let* ((name-str (concatenate 'string "group-" name)) + (value-trim (string-trim '(#\Space) value)) + (value-prop-str (clean-value-prop-str value-trim))) (spinneret:with-html (:label :class "form-label" - (:input :type type :name name-str :value value-str) - (format nil " ~a" (string-trim '(#\Space) value)))))) + (:input :type type :name name-str :value value-prop-str) + (format nil " ~a" value-trim))))) (defun ctrl-describe (id text) (spinneret:with-html