Browse Source

[FIX] javascript lints

pull/297/head
Holger Brunn 6 years ago
parent
commit
0d7e3dab80
No known key found for this signature in database GPG Key ID: 1C9760FECA3AE18
  1. 44
      mail_follower_custom_notification/static/src/js/mail_follower_custom_notification.js

44
mail_follower_custom_notification/static/src/js/mail_follower_custom_notification.js

@ -2,20 +2,16 @@
//© 2015 Therp BV <http://therp.nl> //© 2015 Therp BV <http://therp.nl>
//License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). //License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
openerp.mail_follower_custom_notification = function(instance)
{
openerp.mail_follower_custom_notification = function(instance) {
instance.mail_followers.Followers.include({ instance.mail_followers.Followers.include({
display_subtypes: function(data, id, dialog)
{
display_subtypes: function(data, id, dialog) {
var $list = this.$('.oe_subtype_list ul'); var $list = this.$('.oe_subtype_list ul');
if (dialog)
{
if (dialog) {
$list = this.$dialog.$el; $list = this.$dialog.$el;
} }
$list.empty(); $list.empty();
this._super(data, id, dialog); this._super(data, id, dialog);
$list.find('input[type=checkbox]').change(function()
{
$list.find('input[type=checkbox]').change(function() {
$list.find(_.str.sprintf( $list.find(_.str.sprintf(
'#custom_notification_%s%s', '#custom_notification_%s%s',
jQuery(this).data('id'), jQuery(this).data('id'),
@ -23,14 +19,12 @@ openerp.mail_follower_custom_notification = function(instance)
)) ))
.toggle(jQuery(this).prop('checked')); .toggle(jQuery(this).prop('checked'));
}); });
if(!dialog)
{
if(!dialog) {
$list.find('.oe_custom_notification input[type=radio]') $list.find('.oe_custom_notification input[type=radio]')
.change(this.proxy('do_update_subscription')); .change(this.proxy('do_update_subscription'));
};
}
}, },
do_update_subscription: function(event, user_pid)
{
do_update_subscription: function(event, user_pid) {
/* /*
if(jQuery(event.currentTarget).parents('.oe_custom_notification') if(jQuery(event.currentTarget).parents('.oe_custom_notification')
.length) .length)
@ -44,36 +38,32 @@ openerp.mail_follower_custom_notification = function(instance)
follower_ids = [this.session.uid], follower_ids = [this.session.uid],
custom_notifications = {}, custom_notifications = {},
oe_action = this.$('.oe_actions'); oe_action = this.$('.oe_actions');
if(user_pid)
{
if(user_pid) {
update_func = 'message_custom_notification_update'; update_func = 'message_custom_notification_update';
follower_ids = [user_pid]; follower_ids = [user_pid];
oe_action = jQuery('.oe_edit_actions'); oe_action = jQuery('.oe_edit_actions');
} }
_(follower_ids).each(function(follower)
{
_(follower_ids).each(function(follower) {
var follower_settings = custom_notifications[follower] = {}; var follower_settings = custom_notifications[follower] = {};
oe_action.find('.oe_custom_notification') oe_action.find('.oe_custom_notification')
.each(function()
{
var id = parseInt(jQuery(this).data('id')),
.each(function() {
var id = parseInt(jQuery(this).data('id'), 10),
settings = follower_settings[id] = {}; settings = follower_settings[id] = {};
settings['force_mail'] = jQuery(this)
settings.force_mail = jQuery(this)
.find('.oe_custom_notification_mail input:checked') .find('.oe_custom_notification_mail input:checked')
.val(); .val();
settings['force_own'] = jQuery(this)
settings.force_own = jQuery(this)
.find('.oe_custom_notification_own input:checked') .find('.oe_custom_notification_own input:checked')
.val(); .val();
}); });
}); });
return jQuery.when(this._super.apply(this, arguments)) return jQuery.when(this._super.apply(this, arguments))
.then(function()
{
.then(function() {
return self.ds_model.call( return self.ds_model.call(
update_func, update_func,
[[self.view.datarecord.id], custom_notifications])
})
[[self.view.datarecord.id], custom_notifications]);
});
}, },
}); });
}
};
Loading…
Cancel
Save