Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email subscription for potential future users #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions src/main/resources/assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<head>
<title>Be Neutral</title>

<script src="https://code.jquery.com/jquery-3.5.0.js"></script>

<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, minimum-scale=1, width=device-width, user-scalable=0">
<meta name="description"
Expand Down Expand Up @@ -116,5 +118,50 @@ <h3>Share with the community</h3>
<p style="color:grey;">TODO: maybe include water consumption - as a matter of running out of resources rather than global warming.</p>
</section>

<form action="https://hooks.slack.com/services/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" id="subscribeForm">
<div class="container">
<h2>Subscribe, dear future user</h2>
<p>We are in progress, if you'd like to be one of the first users to test our platform, please let us know by leaving your email address: e-mail@somewhere.com.</p>
</div>

<div class="container" style="background-color:white">
<input type="text" placeholder="Email address" name="email_address" required>
</div>

<div class="container">
<input type="submit" value="Subscribe">
</div>
</form>
<!-- the result of the search will be rendered inside this div -->
<div id="result">

</div>


</body>

<script>
// Attach a submit handler to the form
$( "#subscribeForm" ).submit(function( event ) {

// Stop form from submitting normally
event.preventDefault();

// Get some values from elements on the page:
var $form = $( this ), email = $form.find( "input[name='email_address']" ).val(), url = $form.attr( "action" );

$.ajax({
url: url,
data: '{"text": "' + email + '"}',
type: "POST"
})
.done(function (reply) {
$( "#result" ).empty().append( "Thank you for your subscription!");
})
.fail(function (xhr, status, errorThrown) {
$( "#result" ).empty().append("Failed to subscribe. Try again later, please.");
})
});
</script>

</html>
31 changes: 31 additions & 0 deletions src/main/resources/assets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,34 @@ p {
text-align: center;
width: 100%;
}


form {
border: 3px solid #f1f1f1;
font-family: Arial;
}

.container {
padding: 5px;
background-color: #f1f1f1;
}

input[type=text], input[type=submit] {
width: 100%;
padding: 12px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}


input[type=submit] {
background-color: #4CAF50;
color: white;
border: none;
}

input[type=submit]:hover {
opacity: 0.8;
}