Rushabh Mehta | 5f21cc0 | 2012-08-03 14:13:30 +0530 | [diff] [blame] | 1 | wn.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 | })() |