-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from JessicaML/mailinglist
Mailinglist
- Loading branch information
Showing
4 changed files
with
13 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,21 @@ | ||
import React from "react"; | ||
import $ from "jquery"; | ||
|
||
{ | ||
/* <script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script> | ||
<script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';}(jQuery));var $mcj = jQuery.noConflict(true);</script> */ | ||
} | ||
|
||
class MailingList extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
emailValue: "", | ||
fNameValue: "", | ||
lNameValue: "" | ||
}; | ||
} | ||
|
||
onSubmit() { | ||
preventDefault(); | ||
|
||
$.ajax({ | ||
type: $form.attr("method"), | ||
url: $form.attr("action"), | ||
data: $form.serialize(), | ||
cache: false, | ||
dataType: "json", | ||
contentType: "application/json; charset=utf-8", | ||
error: function(err) { | ||
$(".notification_container").html( | ||
'<span className="alert">Could not connect to server. Please try again later.</span>' | ||
); | ||
}, | ||
success: function(data) { | ||
if (data.result != "success") { | ||
var message = data.msg.substring(); | ||
$(".notification_container").html( | ||
'<span className="alert">' + message + "</span>" | ||
); | ||
} else { | ||
var message = data.msg; | ||
$(".notification_container").html( | ||
'<span className="success">' + message + "</span>" | ||
); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<footer className="footer"> | ||
<form | ||
action="https://github.us16.list-manage.com/subscribe/post-json" | ||
method="POST" | ||
noValidate | ||
id="mc-embedded-subscribe-form" | ||
action="https://github.us16.list-manage.com/subscribe/post?u=70d8e0ea2d8800a5f4e06792c&id=b5095bc718" | ||
method="post" | ||
name="mc-embedded-subscribe-form" | ||
className="validate" | ||
target="_blank" | ||
> | ||
<div id="mc_embed_signup_scroll"> | ||
|
@@ -74,47 +33,21 @@ class MailingList extends React.Component { | |
</div> | ||
<div className="mailchimp"> | ||
<label htmlFor="mce-EMAIL">Subscribe to our mailing list!</label> | ||
|
||
<div> | ||
<input type="hidden" name="u" value="70d8e0ea2d8800a5f4e06792c" /> | ||
<input type="hidden" name="id" value="b5095bc718" /> | ||
<label htmlFor="MERGE0"> | ||
<input | ||
type="email" | ||
name="EMAIL" | ||
id="MERGE0" | ||
value={this.state.emailValue} | ||
onChange={e => { | ||
onChange={(e) => { | ||
this.setState({ emailValue: e.target.value }); | ||
}} | ||
autoCapitalize="off" | ||
autoCorrect="off" | ||
/> | ||
</label> | ||
<input | ||
type="submit" | ||
onClick={this.onSubmit} | ||
defaultValue="Subscribe" | ||
name="subscribe" | ||
id="mc-embedded-subscribe" | ||
className="button" | ||
/> | ||
<div | ||
style={{ position: "absolute", left: "-5000px" }} | ||
aria-hidden="true" | ||
aria-label="Please leave the following three fields empty" | ||
> | ||
<label htmlFor="b_email">Email: </label> | ||
<input | ||
type="email" | ||
name="b_email" | ||
tabIndex="-1" | ||
defaultValue="" | ||
placeholder="[email protected]" | ||
id="b_email" | ||
/> | ||
</div> | ||
<div className="notification_container" /> | ||
<input type="submit" name="subscribe" className="button" /> | ||
</div> | ||
</div> | ||
</form> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,12 +147,9 @@ exports[`Container renders correctly when there are no items 1`] = ` | |
className="footer" | ||
> | ||
<form | ||
action="https://github.us16.list-manage.com/subscribe/post-json" | ||
className="validate" | ||
id="mc-embedded-subscribe-form" | ||
method="POST" | ||
action="https://github.us16.list-manage.com/subscribe/post?u=70d8e0ea2d8800a5f4e06792c&id=b5095bc718" | ||
method="post" | ||
name="mc-embedded-subscribe-form" | ||
noValidate={true} | ||
target="_blank" | ||
> | ||
<div | ||
|
@@ -183,16 +180,6 @@ exports[`Container renders correctly when there are no items 1`] = ` | |
Subscribe to our mailing list! | ||
</label> | ||
<div> | ||
<input | ||
name="u" | ||
type="hidden" | ||
value="70d8e0ea2d8800a5f4e06792c" | ||
/> | ||
<input | ||
name="id" | ||
type="hidden" | ||
value="b5095bc718" | ||
/> | ||
<label | ||
htmlFor="MERGE0" | ||
> | ||
|
@@ -208,39 +195,9 @@ exports[`Container renders correctly when there are no items 1`] = ` | |
</label> | ||
<input | ||
className="button" | ||
defaultValue="Subscribe" | ||
id="mc-embedded-subscribe" | ||
name="subscribe" | ||
onClick={[Function]} | ||
type="submit" | ||
/> | ||
<div | ||
aria-hidden="true" | ||
aria-label="Please leave the following three fields empty" | ||
style={ | ||
Object { | ||
"left": "-5000px", | ||
"position": "absolute", | ||
} | ||
} | ||
> | ||
<label | ||
htmlFor="b_email" | ||
> | ||
Email: | ||
</label> | ||
<input | ||
defaultValue="" | ||
id="b_email" | ||
name="b_email" | ||
placeholder="[email protected]" | ||
tabIndex="-1" | ||
type="email" | ||
/> | ||
</div> | ||
<div | ||
className="notification_container" | ||
/> | ||
</div> | ||
</div> | ||
</form> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,9 @@ exports[`Mailinglist renders correctly when there are no items 1`] = ` | |
className="footer" | ||
> | ||
<form | ||
action="https://github.us16.list-manage.com/subscribe/post-json" | ||
className="validate" | ||
id="mc-embedded-subscribe-form" | ||
method="POST" | ||
action="https://github.us16.list-manage.com/subscribe/post?u=70d8e0ea2d8800a5f4e06792c&id=b5095bc718" | ||
method="post" | ||
name="mc-embedded-subscribe-form" | ||
noValidate={true} | ||
target="_blank" | ||
> | ||
<div | ||
|
@@ -41,16 +38,6 @@ exports[`Mailinglist renders correctly when there are no items 1`] = ` | |
Subscribe to our mailing list! | ||
</label> | ||
<div> | ||
<input | ||
name="u" | ||
type="hidden" | ||
value="70d8e0ea2d8800a5f4e06792c" | ||
/> | ||
<input | ||
name="id" | ||
type="hidden" | ||
value="b5095bc718" | ||
/> | ||
<label | ||
htmlFor="MERGE0" | ||
> | ||
|
@@ -66,39 +53,9 @@ exports[`Mailinglist renders correctly when there are no items 1`] = ` | |
</label> | ||
<input | ||
className="button" | ||
defaultValue="Subscribe" | ||
id="mc-embedded-subscribe" | ||
name="subscribe" | ||
onClick={[Function]} | ||
type="submit" | ||
/> | ||
<div | ||
aria-hidden="true" | ||
aria-label="Please leave the following three fields empty" | ||
style={ | ||
Object { | ||
"left": "-5000px", | ||
"position": "absolute", | ||
} | ||
} | ||
> | ||
<label | ||
htmlFor="b_email" | ||
> | ||
Email: | ||
</label> | ||
<input | ||
defaultValue="" | ||
id="b_email" | ||
name="b_email" | ||
placeholder="[email protected]" | ||
tabIndex="-1" | ||
type="email" | ||
/> | ||
</div> | ||
<div | ||
className="notification_container" | ||
/> | ||
</div> | ||
</div> | ||
</form> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters