Spaces:
No application file
No application file
File size: 2,755 Bytes
d2897cd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
/** NotificationBundle **/
Mautic.notificationOnLoad = function (container, response) {
if (mQuery(container + ' #list-search').length) {
Mautic.activateSearchAutocomplete('list-search', 'notification');
}
Mautic.activatePreviewPanelUpdate();
};
Mautic.selectNotificationType = function(notificationType) {
if (notificationType == 'list') {
mQuery('#leadList').removeClass('hide');
mQuery('#publishStatus').addClass('hide');
mQuery('.page-header h3').text(mauticLang.newListNotification);
} else {
mQuery('#publishStatus').removeClass('hide');
mQuery('#leadList').addClass('hide');
mQuery('.page-header h3').text(mauticLang.newTemplateNotification);
}
mQuery('#notification_notificationType').val(notificationType);
mQuery('body').removeClass('noscroll');
mQuery('.notification-type-modal').remove();
mQuery('.notification-type-modal-backdrop').remove();
};
Mautic.standardNotificationUrl = function(options) {
if (!options) {
return;
}
var url = options.windowUrl;
if (url) {
var editEmailKey = '/notifications/edit/notificationId';
var previewEmailKey = '/notifications/preview/notificationId';
if (url.indexOf(editEmailKey) > -1 ||
url.indexOf(previewEmailKey) > -1) {
options.windowUrl = url.replace('notificationId', mQuery('#campaignevent_properties_notification').val());
}
}
return options;
};
Mautic.disabledNotificationAction = function(opener) {
if (typeof opener == 'undefined') {
opener = window;
}
var notification = opener.mQuery('#campaignevent_properties_notification').val();
var disabled = notification === '' || notification === null;
opener.mQuery('#campaignevent_properties_editNotificationButton').prop('disabled', disabled);
};
Mautic.activatePreviewPanelUpdate = function () {
var notificationPreview = mQuery('#notification-preview');
var notificationForm = mQuery('form[name="notification"]');
if (notificationPreview.length && notificationForm.length) {
var inputs = notificationForm.find('input,textarea');
inputs.on('blur', function () {
var $this = mQuery(this);
var name = $this.attr('name');
if (name === 'notification[heading]') {
notificationPreview.find('h4').text($this.val());
}
if (name === 'notification[message]') {
notificationPreview.find('p').text($this.val());
}
if (name === 'notification[url]') {
notificationPreview.find('span').not('.ri-notification-3-fill').text($this.val());
}
});
}
}; |