1 |
commit: 1e2cee911253fb3ee38aa305e97fa1f4ac7cd515 |
2 |
Author: Alex Legler <alex <AT> a3li <DOT> li> |
3 |
AuthorDate: Fri Oct 14 11:35:36 2016 +0000 |
4 |
Commit: Alex Legler <a3li <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Oct 14 11:35:36 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/sites/www.git/commit/?id=1e2cee91 |
7 |
|
8 |
Improve donation checking UX |
9 |
|
10 |
donate/index.html | 21 +++++++++++---------- |
11 |
1 file changed, 11 insertions(+), 10 deletions(-) |
12 |
|
13 |
diff --git a/donate/index.html b/donate/index.html |
14 |
index 8aa2f05..d36d368 100644 |
15 |
--- a/donate/index.html |
16 |
+++ b/donate/index.html |
17 |
@@ -30,12 +30,13 @@ layout: tyrian |
18 |
<br><br> |
19 |
<script type="text/javascript"> |
20 |
function validate_donation_form() { |
21 |
- var amount_str = document.forms["donate-form"]["amount"].value; |
22 |
+ var input_field = $('#donation-amount'); |
23 |
+ |
24 |
+ var amount_str = input_field.value; |
25 |
var amount_num = +amount_str; // unary conversion op |
26 |
- if (isNaN(amount_num)) { |
27 |
- return false; |
28 |
- } |
29 |
- if (amount_num < 5.00) { |
30 |
+ if (isNaN(amount_num) || amount_num < 5.00) { |
31 |
+ $('#donation-input-group').addClass('has-error'); |
32 |
+ $('#min-notice').addClass('text-danger'); |
33 |
return false; |
34 |
} |
35 |
return true; |
36 |
@@ -52,9 +53,9 @@ layout: tyrian |
37 |
<input type="hidden" name="currency_code" value="USD"> |
38 |
<input type="hidden" name="return" value="https://www.gentoo.org/donate/thanks.html"> |
39 |
<input type="hidden" name="cancel_return" value="https://www.gentoo.org/donate/cancel.html"> |
40 |
- <div class="input-group input-group-lg"> |
41 |
+ <div class="input-group input-group-lg" id="donation-input-group"> |
42 |
<span class="input-group-addon">US $</span> |
43 |
- <input type="text" class="form-control" placeholder="Enter Amount" name="amount" min="5.00" step="0.01"> |
44 |
+ <input id="donation-amount" type="number" class="form-control" placeholder="Enter Amount" name="amount" min="5.00" step="0.01" required> |
45 |
<span class="input-group-btn"> |
46 |
<button class="btn btn-danger" type="submit"><span class="fa fa-fw fa-heart"></span> Donate!</button> |
47 |
</span> |
48 |
@@ -63,9 +64,9 @@ layout: tyrian |
49 |
<br> |
50 |
<small> |
51 |
You can use this form even if you don't have or want to create a PayPal account. |
52 |
- On the next screen, you can pay with your credit card instead. Please note that |
53 |
- there is a US$ 5 minimum, and you may be contacted to confirm your donation is |
54 |
- not fraudulent. |
55 |
+ On the next screen, you can pay with your credit card instead. |
56 |
+ <span id="min-notice">Please note that there is a US$ 5 minimum</span>, |
57 |
+ and you may be contacted to confirm your donation is not fraudulent. |
58 |
</small> |
59 |
</div> |
60 |
</div> |