blob: b3e10a7f70a2e4001a7bdf6d432550b755ecb826 [file] [log] [blame]
Rushabh Mehta5f21cc02012-08-03 14:13:30 +05301wn.provide('erpnext.blog');
2
3(function() {
4 $('body').on('click', '.btn-blog-subscribe', function() {
5 var d = new wn.ui.Dialog({
6 title: "Get Blog Updates via Email",
7 fields: [
8 {label: "Your Name", fieldtype:"Data", reqd:1},
9 {label: "Your Email Address", fieldtype:"Data", reqd:1
10 ,description: "You can unsubscribe anytime."},
11 {label: "Subscribe", fieldtype:"Button"}
12 ]
13 });
14 $(d.fields_dict.subscribe.input).click(function() {
15 var args = d.get_values();
16 if(!args) return;
17 wn.call({
18 method: 'website.blog.add_subscriber',
19 args: args,
20 callback: function(r) {
21 if(r.exc) {
22 msgprint('Opps there seems to be some error, Please check back after some time.');
23 } else {
24 msgprint('Thanks for subscribing!');
25 }
26 d.hide();
27 },
28 btn: this
29 })
30 })
31 d.show()
32 })
33})()