2015-05-25 05:21:01 +00:00
|
|
|
{% if not hide_footer_signup %}
|
2019-03-19 06:18:32 +00:00
|
|
|
<div class="input-group">
|
2020-12-16 04:13:57 +00:00
|
|
|
<input type="text" class="form-control"
|
2019-03-19 06:18:32 +00:00
|
|
|
id="footer-subscribe-email"
|
|
|
|
placeholder="{{ _('Your email address...') }}"
|
|
|
|
aria-label="{{ _('Your email address...') }}"
|
|
|
|
aria-describedby="footer-subscribe-button">
|
|
|
|
<div class="input-group-append">
|
2020-12-16 04:13:57 +00:00
|
|
|
<button class="btn btn-sm btn-default"
|
2019-03-19 06:18:32 +00:00
|
|
|
type="button" id="footer-subscribe-button">{{ _("Get Updates") }}</button>
|
|
|
|
</div>
|
2016-04-09 16:55:21 +00:00
|
|
|
</div>
|
2016-04-12 18:28:20 +00:00
|
|
|
|
2015-05-25 05:21:01 +00:00
|
|
|
<script>
|
2016-01-01 11:53:12 +00:00
|
|
|
frappe.ready(function() {
|
2015-05-25 05:21:01 +00:00
|
|
|
$("#footer-subscribe-button").click(function() {
|
|
|
|
|
2018-02-27 07:29:12 +00:00
|
|
|
if($("#footer-subscribe-email").val() && validate_email($("#footer-subscribe-email").val())) {
|
2015-05-25 05:21:01 +00:00
|
|
|
$("#footer-subscribe-email").attr('disabled', true);
|
|
|
|
$("#footer-subscribe-button").html("Sending...")
|
|
|
|
.attr("disabled", true);
|
|
|
|
erpnext.subscribe_to_newsletter({
|
|
|
|
email: $("#footer-subscribe-email").val(),
|
|
|
|
callback: function(r) {
|
|
|
|
if(!r.exc) {
|
|
|
|
$("#footer-subscribe-button").html(__("Added"))
|
|
|
|
.attr("disabled", true);
|
|
|
|
} else {
|
|
|
|
$("#footer-subscribe-button").html(__("Error: Not a valid id?"))
|
|
|
|
.addClass("btn-danger").attr("disabled", false);
|
|
|
|
$("#footer-subscribe-email").val("").attr('disabled', false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else
|
2017-04-13 12:48:18 +00:00
|
|
|
frappe.msgprint(frappe._("Please enter valid email address"))
|
2015-05-25 05:21:01 +00:00
|
|
|
});
|
2016-01-01 11:53:12 +00:00
|
|
|
});
|
2015-05-25 05:21:01 +00:00
|
|
|
</script>
|
2016-04-09 16:55:21 +00:00
|
|
|
|
2015-05-25 05:21:01 +00:00
|
|
|
{% endif %}
|