File tree 3 files changed +26
-27
lines changed
3 files changed +26
-27
lines changed Original file line number Diff line number Diff line change 38
38
[:p
39
39
[:strong " Parts" ]
40
40
" is being actively developed, and we would love to have your feedback! Please enter your email below to join the private beta test." ]
41
- (partials/waitlist-signup-form " .signup " )]]]]
41
+ (partials/waitlist-signup-form )]]]]
42
42
[:section.aboutus.container
43
43
[:div.content
44
44
[:h3
Original file line number Diff line number Diff line change 12
12
[email]
13
13
(re-matches #".+@.+\. .+" email))
14
14
15
- (defn- form-with-message
16
- " Re-render signup form with a message"
17
- [message]
18
- (html [:p " Please enter your email below to join the private beta test." ]
19
- (partials/waitlist-signup-form " .signup" )
20
- [:div.error
21
- [:p message]]))
22
-
23
15
(defn signup
24
16
" Register email address in private beta waitlist"
25
17
[request]
26
18
(let [email (get-in request [:form-params " email" ])]
27
19
(cond
28
20
(or (nil? email) (str/blank? email))
29
21
(-> (response/response
30
- (form-with-message " Please don't forget your email address!" ))
22
+ (html
23
+ (partials/waitlist-signup-form " Please don't forget your email address!" )))
31
24
(response/status 200 ))
32
25
33
26
(not (valid-email? email))
34
27
(-> (response/response
35
- (form-with-message " Sorry, that's not a valid email address." ))
28
+ (html
29
+ (partials/waitlist-signup-form " Sorry, that's not a valid email address." )))
36
30
(response/status 200 ))
37
31
38
32
:else
Original file line number Diff line number Diff line change 74
74
75
75
(defn waitlist-signup-form
76
76
" Form for signing up for the waiting list"
77
- [target]
78
- [:div#signup-form
79
- [:form {:hx-post " /waitlist-signup"
80
- :hx-target target
81
- :hx-swap " innerHTML"
82
- :hx-on:submit " plausible('Waitlist Signup'); return true;" }
83
- [:input {:type " email"
84
- :id " email"
85
- :name " email"
86
-
87
- :hx-on:focus " plausible('Email Field Focus'); return true;" }]
88
- [:input {:type " hidden"
89
- :id " __anti-forgery-token"
90
- :name " __anti-forgery-token"
91
- :value *anti-forgery-token*}]
92
- [:input {:type " submit" :value " Sign me up!" }]]])
77
+ ([]
78
+ (waitlist-signup-form nil ))
79
+ ([message]
80
+ [:div#signup-form
81
+ [:form {:hx-post " /waitlist-signup"
82
+ :hx-target " #signup-form"
83
+ :hx-swap " outerHTML"
84
+ :hx-on:submit " plausible('Waitlist Signup'); return true;" }
85
+ [:input {:type " email"
86
+ :id " email"
87
+ :name " email"
88
+
89
+ :hx-on:focus " plausible('Email Field Focus'); return true;" }]
90
+ [:input {:type " hidden"
91
+ :id " __anti-forgery-token"
92
+ :name " __anti-forgery-token"
93
+ :value *anti-forgery-token*}]
94
+ [:input {:type " submit" :value " Sign me up!" }]]
95
+ (when message
96
+ [:div.error
97
+ [:p message]])]))
You can’t perform that action at this time.
0 commit comments