Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
template.find('.failover-number').on('click', function() {
// We add this at the moment of the event because in some cases, we bind the events before it's adding to a parent,
// which means the account-section might not be loaded yet if we bound it before the event happened.
if ($(this).parents('.account-section').length) {
args.accountId = template.parents('.account-section').data('id');
}
monster.pub('common.failover.renderPopup', args);
});
callback: function() {
if (toggle) {
/* when all the badges have been updated, display my account */
if (!--countBadges) {
monster.pub('core.showAppName', 'myaccount');
self.toggle({
callback: callback
});
}
}
}
});
parent.find('.category#numbers').on('click', function() {
monster.pub('voip.numbers.render', container);
});
_errorTrackerRenderContent: function(args) {
var self = this,
dataTemplate = self.errorTrackerFormatData(monster.logs.error),
listErrorTemplates = $(self.getTemplate({
name: 'layout',
data: dataTemplate,
submodule: 'errorTracker'
}));
self.errorTrackerBindEvents(listErrorTemplates);
monster.pub('myaccount.renderSubmodule', listErrorTemplates);
args.callback && args.callback(listErrorTemplates);
},
}, function(err, results) {
var formattedData = self.userLayoutFormatData(results),
userTemplate = $(self.getTemplate({
name: 'layout',
data: formattedData,
submodule: 'user'
}));
self.userBindingEvents(userTemplate, results);
monster.pub('myaccount.renderSubmodule', userTemplate);
if (typeof args.callback === 'function') {
args.callback(userTemplate);
}
});
},
self.balanceDisplayGenericTable('per-minute-voip', balance, renderData.uiRestrictions.balance.show_credit, function() {
monster.pub('myaccount.updateMenu', args);
monster.pub('myaccount.renderSubmodule', balance);
if (typeof argsCallback === 'function') {
argsCallback(balance);
}
});
}
self.profileFormatData(results, function(results) {
var profile = $(monster.template(self, 'profile-layout', results));
self.profileBindEvents(profile, results);
monster.pub('myaccount.renderSubmodule', profile);
if(args.uiTab) {
profile.find('a[href="#'+args.uiTab+'"]').tab('show');
}
if(typeof args.callback === 'function') {
args.callback(profile);
}
});
}
self.balanceDisplayGenericTable('per-minute-voip', balance, renderData.uiRestrictions.balance.show_credit, function() {
monster.pub('myaccount.updateMenu', args);
monster.pub('myaccount.renderSubmodule', balance);
if (typeof argsCallback === 'function') {
argsCallback(balance);
}
});
}
container.on('click', '.action-links .spare-link:not(.disabled)', function(e) {
e.preventDefault();
var args = {
accountName: monster.apps['auth'].currentAccount.name,
accountId: self.accountId,
callback: function(numberList) {
var numbers = $.map(numberList, function(val) {
return val.phoneNumber;
});
addNumbersToMainCallflow(numbers);
}
}
monster.pub('common.numbers.dialogSpare', args);
});
container.on('click', '.action-links .spare-link:not(.disabled)', function(e) {
e.preventDefault();
var args = {
accountName: monster.apps.auth.currentAccount.name,
accountId: self.accountId,
callback: function(numberList) {
var numbers = $.map(numberList, function(val) {
return val.phoneNumber;
});
addNumbersToMainCallflow(numbers);
}
};
monster.pub('common.numbers.dialogSpare', args);
});