From 4a35a88c782a63b180e6c538ea773c9d1df354ad Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 19 May 2013 03:16:56 +0200 Subject: Extract eliss-hidden-input --- eliss.el | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/eliss.el b/eliss.el index 31f9652..aadc35d 100644 --- a/eliss.el +++ b/eliss.el @@ -84,6 +84,18 @@ certain other properties. `((placeholder ,placeholder))) ,@(when default `((value ,default))))))))) +(defun eliss-hidden-input (name &rest plist) + "Create a input with type hidden. + +Give it the name NAME and take some other properties from +proprety list PLIST: + +- `:value' specifies the value attribute the input should get." + (let ((value (plist-get plist :value))) + `(input (@ (type "hidden") + (name ,name) + ,@(when value `((value ,value))))))) + (defun eliss-project-page (httpcon) "Send a list of issues and an issue-creation form over HTTPCON." (let* ((project (match-string 1 (elnode-http-mapping httpcon))) @@ -123,11 +135,8 @@ certain other properties. ,(eliss-control-group "email" "Email" :placeholder "john@example.com") - (input (@ (type "hidden") - (name "i-m-human") - (value "t"))) - (input (@ (type "hidden") - (name "i-r-bot"))) + ,(eliss-hidden-input "i-m-human" :value "t") + ,(eliss-hidden-input "i-r-bot") (input (@ (type "submit") (value "Complain") (class "pull-right")))) @@ -196,11 +205,9 @@ certain other properties. "email" "Email" :placeholder "john@example.com" :required t) - (input (@ (type "hidden") - (name "i-m-human") - (value "t"))) - (input (@ (type "hidden") - (name "i-r-bot"))) + ,(eliss-hidden-input "i-m-human" + :value "t") + ,(eliss-hidden-input "i-r-bot") (input (@ (type "submit") (value "Comment") (class "pull-right")))) -- cgit v1.2.3-54-g00ecf