brotherton-erpnext/erpnext/templates/includes/footer/footer_extension.html

40 lines
1.2 KiB
HTML

{% if not hide_footer_signup %}
<div class='input-group input-group-sm pull-right footer-subscribe'>
<input class="form-control" type="text" id="footer-subscribe-email"
placeholder="{{ _('Your email address') }}...">
<span class='input-group-btn'>
<button class="btn btn-default" type="button"
id="footer-subscribe-button">{{ _("Get Updates") }}</button>
</span>
</div>
<script>
frappe.ready(function() {
$("#footer-subscribe-button").click(function() {
if($("#footer-subscribe-email").val()) {
$("#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
frappe.msgprint(frappe._("Please enter email address"))
});
});
</script>
{% endif %}