blob: e40825d576003583dede823f0a62a26c363b5d79 [file] [log] [blame]
Anand Doshi79c4d7c2013-11-21 18:28:25 +05301<div class="container">
2 <div class="row">
Rushabh Mehta4ef18352014-04-22 16:52:11 +05303 <div class="col-sm-6 col-sm-offset-3" style="margin-top: 7px;">
4 <div class="input-group">
5 <input class="form-control" type="text" id="footer-subscribe-email"
6 placeholder="{{ _('Your email address') }}...">
7 <span class="input-group-btn">
8 <button class="btn btn-default" type="button"
9 id="footer-subscribe-button">{{ _("Stay Updated") }}</button>
10 </span>
11 </div>
Anand Doshi79c4d7c2013-11-21 18:28:25 +053012 </div>
13 </div>
Rushabh Mehta4c6120a2013-09-10 12:18:58 +053014</div>
Rushabh Mehta4c6120a2013-09-10 12:18:58 +053015<script>
16 $("#footer-subscribe-button").click(function() {
17
Rushabh Mehta4c6120a2013-09-10 12:18:58 +053018 if($("#footer-subscribe-email").val()) {
Akhilesh Darjeea7ab20e2014-01-28 15:50:28 +053019 $("#footer-subscribe-email").attr('disabled', true);
20 $("#footer-subscribe-button").html("Sending...")
21 .attr("disabled", true);
Rushabh Mehta4c6120a2013-09-10 12:18:58 +053022 erpnext.send_message({
23 subject:"Subscribe me",
24 sender: $("#footer-subscribe-email").val(),
25 message: "Subscribe to newsletter (via website footer).",
26 callback: function(r) {
27 if(!r.exc) {
28 $("#footer-subscribe-button").html("Thank You :)")
29 .addClass("btn-success").attr("disabled", true);
30 } else {
31 $("#footer-subscribe-button").html("Error :( Not a valid id?")
32 .addClass("btn-danger").attr("disabled", false);
33 $("#footer-subscribe-email").val("").attr('disabled', false);
34 }
35 }
36 });
37 }
Akhilesh Darjeea7ab20e2014-01-28 15:50:28 +053038 else
Rushabh Mehta793ba6b2014-02-14 15:47:51 +053039 frappe.msgprint(frappe._("Please enter email address"))
Rushabh Mehta4c6120a2013-09-10 12:18:58 +053040 });
41</script>