Spaces:
No application file
No application file
File size: 3,184 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 84 85 86 87 88 |
//PageBundle
Mautic.pageOnLoad = function (container, response) {
if (mQuery(container + ' #list-search').length) {
Mautic.activateSearchAutocomplete('list-search', 'page.page');
}
if (mQuery(container + ' #page_template').length) {
Mautic.toggleBuilderButton(mQuery('#page_template').val() == '');
//Handle autohide of "Redirect URL" field if "Redirect Type" is none
if (mQuery(container + ' select[name="page[redirectType]"]').length) {
//Auto-hide on page loading
Mautic.autoHideRedirectUrl(container);
//Auto-hide on select changing
mQuery(container + ' select[name="page[redirectType]"]').chosen().change(function(){
Mautic.autoHideRedirectUrl(container);
});
}
// Preload tokens for code mode builder
Mautic.getTokens(Mautic.getBuilderTokensMethod(), function(){});
Mautic.initSelectTheme(mQuery('#page_template'));
}
// Open the builder directly when saved from the builder
if (response && response.inBuilder) {
Mautic.launchBuilder('page');
Mautic.processBuilderErrors(response);
}
};
Mautic.getPageAbTestWinnerForm = function(abKey) {
if (abKey && mQuery(abKey).val() && mQuery(abKey).closest('.form-group').hasClass('has-error')) {
mQuery(abKey).closest('.form-group').removeClass('has-error');
if (mQuery(abKey).next().hasClass('help-block')) {
mQuery(abKey).next().remove();
}
}
Mautic.activateLabelLoadingIndicator('page_variantSettings_winnerCriteria');
var pageId = mQuery('#page_sessionId').val();
var query = "action=page:getAbTestForm&abKey=" + mQuery(abKey).val() + "&pageId=" + pageId;
mQuery.ajax({
url: mauticAjaxUrl,
type: "POST",
data: query,
dataType: "json",
success: function (response) {
if (typeof response.html != 'undefined') {
if (mQuery('#page_variantSettings_properties').length) {
mQuery('#page_variantSettings_properties').replaceWith(response.html);
} else {
mQuery('#page_variantSettings').append(response.html);
}
if (response.html != '') {
Mautic.onPageLoad('#page_variantSettings_properties', response);
}
}
Mautic.removeLabelLoadingIndicator();
},
error: function (request, textStatus, errorThrown) {
Mautic.processAjaxError(request, textStatus, errorThrown);
spinner.remove();
},
complete: function () {
Mautic.removeLabelLoadingIndicator();
}
});
};
Mautic.autoHideRedirectUrl = function(container) {
var select = mQuery(container + ' select[name="page[redirectType]"]');
var input = mQuery(container + ' input[name="page[redirectUrl]"]');
//If value is none we autohide the "Redirect URL" field and empty it
if (select.val() == '') {
input.closest('.form-group').hide();
input.val('');
} else {
input.closest('.form-group').show();
}
}; |