Skip to content

Commit

Permalink
Use MailerLite newsletter form.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikulikov committed Jan 9, 2018
1 parent c2b3dc9 commit 38a0b1e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 50 deletions.
51 changes: 1 addition & 50 deletions _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,7 @@
<a href="/docs/contact-us/">Contact us</a>
</nav>
<div class="newsletterSubsContainer">
<form id="newsletter-form" method="post" onsubmit="return validateNewsletterForm(this)">
<fieldset>
<div class="newsletterInputs">
<p class="subsTitle">Sign up for ThingsBoard IoT newsletter</p>
<input id="subsEmail" placeholder="Email" class="text-input" name="email" type="text" size="20" maxlength="80">
<input type="hidden" name="_next" value="/docs/newsletter-thanks/" />
<input type="text" name="_gotcha" style="display:none" />
<input class="button" value="Submit" type="submit">
</div>
</fieldset>
</form>
<script type="text/javascript" src="https://app.mailerlite.com/data/webforms/708170/r9r9x7.js?v5"></script>
</div>
<div class="center">
<div class="social">
Expand All @@ -38,43 +28,4 @@
</div>
<div id="miceType" class="center">&copy; {{ 'now' | date: "%Y" }} The ThingsBoard Authors</div>
</main>

<script type="text/javascript">

function validateNewsletterForm(form) {
var email = $('input[name=email]', form).val();

if (!validateValue('Email Address', email)) {
return false;
}

var emailExp = /^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
if(email.match(emailExp)==null) {
window.alert("Entered Email Address is not valid.");
return false;
}
return true;
}

function validateValue(name, val) {
if (isEmpty(val)) {
window.alert("Please fill '" + name + "' field.");
return false;
}
return true;
}

function isEmpty(val) {
return val === undefined || val.trim().length == 0;
}

</script>

<script type="text/javascript">

var newsletterform = document.getElementById('newsletter-form');
newsletterform.setAttribute('action', 'https://formspree.io/' + 'newsletter' + '@' + 'thingsboard' + '.' + 'io');

</script>

</footer>
16 changes: 16 additions & 0 deletions _sass/_base.sass
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,22 @@ footer
text-decoration: none

.newsletterSubsContainer
#mlb2-7341216
.subscribe-form
background: none !important
border: none !important

#mlb2-7341216.ml-subscribe-form
.form-group
.form-control
background-color: transparent !important
font-family: "Roboto",sans-serif
padding: 10px
font-size: 16px
font-weight: 100
color: #fff
border: 1px solid #fff
transition: .3s
width: 100%
display: flex
align-items: center
Expand Down

0 comments on commit 38a0b1e

Please sign in to comment.