Show loading icon when loading newsletter preview

This commit is contained in:
Tautvidas Sipavičius
2016-03-01 17:50:51 +02:00
parent df775b5a07
commit 9e84e8df93

View File

@@ -230,15 +230,17 @@ define([
json.body = JSON.stringify(json.body); json.body = JSON.stringify(json.body);
} }
MailPoet.Modal.loading(true);
MailPoet.Ajax.post({ MailPoet.Ajax.post({
endpoint: 'newsletters', endpoint: 'newsletters',
action: 'render', action: 'render',
data: json, data: json,
}).done(function(response){ }).done(function(response){
console.log('Should open a new window'); MailPoet.Modal.loading(false);
window.open('data:text/html;charset=utf-8,' + encodeURIComponent(response.rendered_body), '_blank'); window.open('data:text/html;charset=utf-8,' + encodeURIComponent(response.rendered_body), '_blank');
}).fail(function(error) { }).fail(function(error) {
console.log('Preview error', json); MailPoet.Modal.loading(false);
alert('Something went wrong, check console'); alert('Something went wrong, check console');
}); });
}, },