working lisp server implementation
This commit is contained in:
		
							parent
							
								
									22e5161b4c
								
							
						
					
					
						commit
						1993554db0
					
				
					 6 changed files with 24 additions and 68 deletions
				
			
		| 
						 | 
				
			
			@ -4726,61 +4726,11 @@ pre {
 | 
			
		|||
  color: rgba(var(--color-neutral-500), var(--tw-text-opacity));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.invalid\:border-secondary-100:invalid {
 | 
			
		||||
  --tw-border-opacity: 1;
 | 
			
		||||
  border-color: rgba(var(--color-secondary-100), var(--tw-border-opacity));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.invalid\:text-secondary-600:invalid {
 | 
			
		||||
  --tw-text-opacity: 1;
 | 
			
		||||
  color: rgba(var(--color-secondary-600), var(--tw-text-opacity));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.invalid\:text-primary-600:invalid {
 | 
			
		||||
  --tw-text-opacity: 1;
 | 
			
		||||
  color: rgba(var(--color-primary-600), var(--tw-text-opacity));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.invalid\:text-secondary-100:invalid {
 | 
			
		||||
  --tw-text-opacity: 1;
 | 
			
		||||
  color: rgba(var(--color-secondary-100), var(--tw-text-opacity));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.invalid\:text-secondary-900:invalid {
 | 
			
		||||
  --tw-text-opacity: 1;
 | 
			
		||||
  color: rgba(var(--color-secondary-900), var(--tw-text-opacity));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.invalid\:text-\[\#660000\]:invalid {
 | 
			
		||||
  --tw-text-opacity: 1;
 | 
			
		||||
  color: rgb(102 0 0 / var(--tw-text-opacity));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.invalid\:text-\[\#990000\]:invalid {
 | 
			
		||||
  --tw-text-opacity: 1;
 | 
			
		||||
  color: rgb(153 0 0 / var(--tw-text-opacity));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.invalid\:text-\[\#FF0000\]:invalid {
 | 
			
		||||
  --tw-text-opacity: 1;
 | 
			
		||||
  color: rgb(255 0 0 / var(--tw-text-opacity));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.invalid\:text-\[\#F39\]:invalid {
 | 
			
		||||
  --tw-text-opacity: 1;
 | 
			
		||||
  color: rgb(255 51 153 / var(--tw-text-opacity));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.invalid\:ring-secondary-100:invalid {
 | 
			
		||||
  --tw-ring-opacity: 1;
 | 
			
		||||
  --tw-ring-color: rgba(var(--color-secondary-100), var(--tw-ring-opacity));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.invalid\:ring-secondary-900:invalid {
 | 
			
		||||
  --tw-ring-opacity: 1;
 | 
			
		||||
  --tw-ring-color: rgba(var(--color-secondary-900), var(--tw-ring-opacity));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.invalid\:ring-\[\#f39\]:invalid {
 | 
			
		||||
  --tw-ring-opacity: 1;
 | 
			
		||||
  --tw-ring-color: rgb(255 51 153 / var(--tw-ring-opacity));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,5 @@
 | 
			
		|||
<script src="https://unpkg.com/htmx.org@1.9.12" integrity="sha384-ujb1lZYygJmzgSwoxRggbCHcjc0rB2XoQrxeTUQyRjrOnlCoYta87iKBWq3EsdM2" crossorigin="anonymous"></script>
 | 
			
		||||
 | 
			
		||||
<div style="padding-left:0;padding-right:0;padding-top:2px;padding-bottom:3px"
 | 
			
		||||
    class="main-menu flex items-center justify-between px-4 py-6 sm:px-6 md:justify-start space-x-3">
 | 
			
		||||
    {{ if .Site.Params.Logo }}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,6 @@
 | 
			
		|||
{{ $formClasses := "bg-neutral-500 text-neutral-50 placeholder-neutral-300 focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 focus:ring-offset-transparent m-2 p-3 rounded-lg hover:bg-neutral-500 checked:text-neutral-500" }}
 | 
			
		||||
{{ $requiredField := "<span class='inline-block text-[#f39] text-sm align-super'>* required</span>" }}
 | 
			
		||||
 | 
			
		||||
<script src="https://unpkg.com/htmx.org@1.9.12/dist/htmx.js" crossorigin="anonymous"></script>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
 function submitForm(e) {
 | 
			
		||||
| 
						 | 
				
			
			@ -127,7 +126,7 @@
 | 
			
		|||
</script>
 | 
			
		||||
 | 
			
		||||
<div id="mt-form" class="form text-lg w-full">
 | 
			
		||||
    <form id='form' data-hx-post="http://localhost:4242/camp-api" autocomplete="on" method="post" target="_parent" class="w-full items-center flex flex-wrap">
 | 
			
		||||
    <form id='form' hx-post="http://localhost:4242/camp-api" autocomplete="on" method="post" target="_parent" class="w-full items-center flex flex-wrap">
 | 
			
		||||
        <h3 class="basis-full">Camp Form</h3>
 | 
			
		||||
        <div class="basis-full flex flex-wrap my-4">
 | 
			
		||||
            <label for="firstname" class="basis-full">What is your first and last name? <span class='inline-block text-[#f39] text-sm align-sub'>* required</span></label>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 288 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 75 KiB  | 
| 
						 | 
				
			
			@ -382,24 +382,29 @@ with the image attached"
 | 
			
		|||
                         (:td (cdr row))))))))))))
 | 
			
		||||
 | 
			
		||||
(hunchentoot:define-easy-handler (respond :uri "/camp-api") ()
 | 
			
		||||
  (uiop:println "hey")
 | 
			
		||||
  (setf (hunchentoot:content-type*) "plain/text")
 | 
			
		||||
  (let* ((request-type (hunchentoot:request-method hunchentoot:*request*))
 | 
			
		||||
         (data (hunchentoot:post-parameters* hunchentoot:*request*)))
 | 
			
		||||
    (uiop:println (assoc "registration" data :test 'string=))
 | 
			
		||||
    (uiop:println (tbnl:headers-out*))
 | 
			
		||||
    (if (string= (cdr (assoc "registration" data :test 'string=)) "now")
 | 
			
		||||
        (progn (uiop:println "did it")
 | 
			
		||||
               (setf (hunchentoot:header-out "HX-Redirect") "https://secure.myvanco.com/L-Z772/campaign/C-13JPJ")
 | 
			
		||||
               (uiop:println (tbnl:headers-out*))
 | 
			
		||||
               (uiop:println (hunchentoot:return-code*))
 | 
			
		||||
               (with-html-string
 | 
			
		||||
                 (:div
 | 
			
		||||
                  (:p "Payment"))))
 | 
			
		||||
         (data (hunchentoot:post-parameters* hunchentoot:*request*))
 | 
			
		||||
         (registration (cdr (assoc "registration" data :test 'string=)))
 | 
			
		||||
         (health (cdr (assoc "health" data :test 'string=))))
 | 
			
		||||
    (uiop:println data)
 | 
			
		||||
    ;; This is extremely necessary so that cors is right
 | 
			
		||||
    (setf (tbnl:header-out :access-control-expose-headers) "*")
 | 
			
		||||
    (if (string= health "later")
 | 
			
		||||
        (progn (uiop:println "Selected health later")
 | 
			
		||||
               (cond ((string= registration "now")
 | 
			
		||||
                      (setf (hunchentoot:header-out :HX-Redirect) "https://secure.myvanco.com/L-Z772/campaign/C-13JPJ")
 | 
			
		||||
                      (uiop:println (tbnl:headers-out*))
 | 
			
		||||
                      (uiop:println (hunchentoot:return-code*))
 | 
			
		||||
                      (mail-camp-form data nil))
 | 
			
		||||
                     ((string= registration "full")
 | 
			
		||||
                      (setf (tbnl:header-out :HX-Redirect) "https://secure.myvanco.com/L-Z772/campaign/C-13JQE")
 | 
			
		||||
                      (uiop:println (tbnl:headers-out*))
 | 
			
		||||
                      (mail-camp-form data nil))))
 | 
			
		||||
        (progn
 | 
			
		||||
          (with-html-string
 | 
			
		||||
            (:div
 | 
			
		||||
             (:p "Thank You")))))))
 | 
			
		||||
          (uiop:println "Health now")
 | 
			
		||||
          (setf (tbnl:header-out :HX-Redirect) (format nil "/camp-health-form?registration=~A" registration))
 | 
			
		||||
          (uiop:println (tbnl:headers-out*))
 | 
			
		||||
          (mail-camp-form data nil)))))
 | 
			
		||||
 | 
			
		||||
(defun define-post-form-handler (uri mail-function)
 | 
			
		||||
  "Take a uri and a mailer function and define a handler in hunchentoot
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue