updated MP.Notice in order to handle arrays as error messages
This commit is contained in:
@@ -192,21 +192,28 @@ define('notice', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
|||||||
error: function(message, options) {
|
error: function(message, options) {
|
||||||
this.show(jQuery.extend({}, {
|
this.show(jQuery.extend({}, {
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: '<p>'+message+'</p>'
|
message: '<p>'+this.formatMessage(message)+'</p>'
|
||||||
}, options));
|
}, options));
|
||||||
},
|
},
|
||||||
success: function(message, options) {
|
success: function(message, options) {
|
||||||
this.show(jQuery.extend({}, {
|
this.show(jQuery.extend({}, {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: '<p>'+message+'</p>'
|
message: '<p>'+this.formatMessage(message)+'</p>'
|
||||||
}, options));
|
}, options));
|
||||||
},
|
},
|
||||||
system: function(message, options) {
|
system: function(message, options) {
|
||||||
this.show(jQuery.extend({}, {
|
this.show(jQuery.extend({}, {
|
||||||
type: 'system',
|
type: 'system',
|
||||||
static: true,
|
static: true,
|
||||||
message: message
|
message: '<p>'+this.formatMessage(message)+'</p>'
|
||||||
}, options));
|
}, options));
|
||||||
|
},
|
||||||
|
formatMessage: function(message) {
|
||||||
|
if(Array.isArray(message)) {
|
||||||
|
return message.join('<br />');
|
||||||
|
} else {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user