[FIX] website:_mail: fix followers

bzr revid: chm@openerp.com-20140129170829-abmv73xswzl6ccm9
This commit is contained in:
Christophe Matthieu 2014-01-29 18:08:29 +01:00
parent 632c014b76
commit b7f88a58fb
2 changed files with 8 additions and 2 deletions

View File

@ -6,6 +6,11 @@ $(document).ready(function () {
var self = this;
var $data = $(this).parents("div.js_follow");
var $email = $data.find(".js_follow_email");
if ($email.length && !$email.val().match(/.+@.+/)) {
return false;
}
var message_is_follower = $data.attr("data-follow") || "off";
$data.attr("data-follow", message_is_follower == 'off' ? 'on' : 'off');
@ -13,7 +18,7 @@ $(document).ready(function () {
'id': $data.data('id'),
'object': $data.data('object'),
'message_is_follower': message_is_follower,
'email': $email && $email.val() || false,
'email': $email.length ? $email.val() : false,
}).then(function (result) {
if (result) {
$data.find(" > *").toggleClass("hidden");

View File

@ -10,7 +10,8 @@
type="email" name="email"
class="js_follow_email form-control"
t-att-value="email or ''"
placeholder="your email..."/>
placeholder="your email..."
groups="base.group_public"/>
<span class="input-group-btn">
<button href="#" t-attf-class="btn btn-default js_unfollow_btn">Unsubscribe</button>
<button href="#" t-attf-class="btn btn-primary js_follow_btn">Subscribe</button>