Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Small Technology Foundation web site
spikes
patronage
Commits
42097141
Verified
Commit
42097141
authored
Aug 02, 2019
by
Aral Balkan
Browse files
Consistency: use custom donation instead of other donation
parent
372c7853
Changes
3
Hide whitespace changes
Inline
Side-by-side
fund-us/css/index.css
View file @
42097141
...
...
@@ -76,7 +76,6 @@ input[name="donationAmount"]
}
.patronageForm
{
padding
:
10px
;
...
...
@@ -220,14 +219,14 @@ input[name="donationAmount"] + label
border
:
2px
solid
#eee
;
}
#
other
DonationLabel
#
custom
DonationLabel
{
font-size
:
16px
;
padding-top
:
5px
;
line-height
:
30px
;
}
#
other
DonationLabel
>
input
#
custom
DonationLabel
>
input
{
margin-left
:
3px
;
margin-right
:
3px
;
...
...
@@ -252,7 +251,7 @@ input[name="donationAmount"] + label
}
@media
only
screen
and
(
min-width
:
380px
)
{
#
other
DonationLabel
>
input
#
custom
DonationLabel
>
input
{
margin-left
:
7px
;
margin-right
:
7px
;
...
...
fund-us/index.html
View file @
42097141
...
...
@@ -51,7 +51,7 @@
<input
type=
'radio'
name=
'donationAmount'
value=
'50'
class=
'hidden selectButton'
id=
'tier6'
><label
class=
'donationTierButtonLabel unselectable'
for=
'tier6'
>
€50
</label>
<input
type=
'radio'
name=
'donationAmount'
value=
'100'
class=
'hidden selectButton'
id=
'tier7'
><label
class=
'donationTierButtonLabel unselectable'
for=
'tier7'
>
€100
</label>
<!-- Unfortunately can’t use an input type='number' here because the events are not fired consistently across major browsers. -->
<input
type=
'radio'
name=
'donationAmount'
value=
'-1'
class=
'hidden selectButton'
id=
'tier8'
><label
class=
'donationTierButtonLabel unselectable'
id=
'
other
DonationLabel'
for=
'tier8'
>
Other
<input
id=
'
other
DonationAmount'
type=
'string'
pattern=
'[0-9]{1,6}'
title=
'Custom donation amount'
></input></label>
<input
type=
'radio'
name=
'donationAmount'
value=
'-1'
class=
'hidden selectButton'
id=
'tier8'
><label
class=
'donationTierButtonLabel unselectable'
id=
'
custom
DonationLabel'
for=
'tier8'
>
Other
<input
id=
'
custom
DonationAmount'
type=
'string'
pattern=
'[0-9]{1,6}'
title=
'Custom donation amount'
></input></label>
</fieldset>
<button
type=
'submit'
id=
'submitButton'
>
Become a patron
</button>
...
...
fund-us/js/index.js
View file @
42097141
...
...
@@ -101,8 +101,8 @@ class PatronageForm {
this
.
interface
=
{
patronageForm
:
$
(
'
#patronageForm
'
),
submitButton
:
$
(
'
#submitButton
'
),
other
DonationAmountTextInput
:
$
(
'
#
other
DonationAmount
'
),
other
DonationAmountRadioButton
:
$
(
'
#tier8
'
),
custom
DonationAmountTextInput
:
$
(
'
#
custom
DonationAmount
'
),
custom
DonationAmountRadioButton
:
$
(
'
#tier8
'
),
serverError
:
$
(
'
#serverError
'
),
errorMessage
:
$
(
'
#errorMessage
'
),
...
...
@@ -129,10 +129,10 @@ class PatronageForm {
// Ensure that selecting either the button or the text input focuses the custom
// amount control and that focus is not lost when person clicks on already-selected control.
this
.
interface
.
other
DonationAmountRadioButton
.
addEventListener
(
'
click
'
,
updateFormState
)
this
.
interface
.
other
DonationAmountTextInput
.
addEventListener
(
'
click
'
,
updateFormState
)
this
.
interface
.
other
DonationAmountTextInput
.
addEventListener
(
'
focus
'
,
updateFormState
)
this
.
interface
.
other
DonationAmountTextInput
.
addEventListener
(
'
input
'
,
updateFormState
)
this
.
interface
.
custom
DonationAmountRadioButton
.
addEventListener
(
'
click
'
,
updateFormState
)
this
.
interface
.
custom
DonationAmountTextInput
.
addEventListener
(
'
click
'
,
updateFormState
)
this
.
interface
.
custom
DonationAmountTextInput
.
addEventListener
(
'
focus
'
,
updateFormState
)
this
.
interface
.
custom
DonationAmountTextInput
.
addEventListener
(
'
input
'
,
updateFormState
)
//
// Handle form submit requests.
...
...
@@ -158,31 +158,31 @@ class PatronageForm {
// Handle the label of the submit button based on the type of donation.
this
.
interface
.
submitButton
.
innerHTML
=
this
.
isPatronage
?
'
Become a patron
'
:
'
Donate
'
const
other
DonationAmountTextInput
=
this
.
interface
.
other
DonationAmountTextInput
const
custom
DonationAmountTextInput
=
this
.
interface
.
custom
DonationAmountTextInput
// If the donation amount text input has focus, ensure that the corresponding
// radio button is also selected.
if
(
other
DonationAmountTextInput
===
document
.
activeElement
)
{
this
.
interface
.
other
DonationAmountRadioButton
.
checked
=
true
if
(
custom
DonationAmountTextInput
===
document
.
activeElement
)
{
this
.
interface
.
custom
DonationAmountRadioButton
.
checked
=
true
}
// Handle the state of the custom donation amount control.
if
(
this
.
interface
.
selectedDonationAmountButton
().
id
===
'
tier8
'
)
{
// Custom donation is active
other
DonationAmountTextInput
.
style
.
opacity
=
1
other
DonationAmountTextInput
.
focus
()
let
other
DonationAmountString
=
other
DonationAmountTextInput
.
value
other
DonationAmountString
=
other
DonationAmountString
.
slice
(
0
,
6
)
// Limit to six digits.
let
other
DonationAmountInteger
=
parseInt
(
other
DonationAmountString
)
// Ensure it is a valid integer.
other
DonationAmountTextInput
.
value
=
isNaN
(
other
DonationAmountInteger
)
?
''
:
other
DonationAmountInteger
custom
DonationAmountTextInput
.
style
.
opacity
=
1
custom
DonationAmountTextInput
.
focus
()
let
custom
DonationAmountString
=
custom
DonationAmountTextInput
.
value
custom
DonationAmountString
=
custom
DonationAmountString
.
slice
(
0
,
6
)
// Limit to six digits.
let
custom
DonationAmountInteger
=
parseInt
(
custom
DonationAmountString
)
// Ensure it is a valid integer.
custom
DonationAmountTextInput
.
value
=
isNaN
(
custom
DonationAmountInteger
)
?
''
:
custom
DonationAmountInteger
}
else
{
// Clear the other donation amount entry if it is not valid and
// it isn’t selected.
if
(
!
this
.
other
DonationAmountIsValid
)
{
document
.
getElementById
(
'
other
DonationAmount
'
)
.
value
=
''
if
(
!
this
.
custom
DonationAmountIsValid
)
{
this
.
interface
.
custom
DonationAmount
TextInput
.
value
=
''
}
// De-emphasize the text input when the control is not in focus.
document
.
getElementById
(
'
other
DonationAmount
'
)
.
style
.
opacity
=
0.5
this
.
interface
.
custom
DonationAmount
TextInput
.
style
.
opacity
=
0.5
}
// Enable/disable the submit button based on whether the form is valid.
...
...
@@ -238,7 +238,7 @@ class PatronageForm {
get
customDonationAmount
()
{
const
amount
=
Number
(
this
.
interface
.
other
DonationAmountTextInput
.
value
)
const
amount
=
Number
(
this
.
interface
.
custom
DonationAmountTextInput
.
value
)
if
(
amount
>
0
)
{
return
amount
}
else
{
...
...
@@ -247,8 +247,8 @@ class PatronageForm {
}
get
other
DonationAmountIsValid
()
{
return
Number
(
this
.
interface
.
other
DonationAmountTextInput
.
value
)
>
0
get
custom
DonationAmountIsValid
()
{
return
Number
(
this
.
interface
.
custom
DonationAmountTextInput
.
value
)
>
0
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment