fixed onSuccess on bulk actions and locale formatted numbers in success messages
This commit is contained in:
@@ -47,13 +47,13 @@ function(
|
||||
|
||||
data.action = this.state.action;
|
||||
|
||||
var callback = function() {};
|
||||
var onSuccess = function() {};
|
||||
if(action['onSuccess'] !== undefined) {
|
||||
callback = action.onSuccess;
|
||||
onSuccess = action.onSuccess;
|
||||
}
|
||||
|
||||
if(data.action) {
|
||||
this.props.onBulkAction(selected_ids, data, callback);
|
||||
this.props.onBulkAction(selected_ids, data).then(onSuccess);
|
||||
}
|
||||
|
||||
this.setState({
|
||||
|
@@ -546,9 +546,9 @@ const Listing = React.createClass({
|
||||
endpoint: this.props.endpoint,
|
||||
action: 'bulkAction',
|
||||
data: data
|
||||
}).done(function() {
|
||||
}).done(() => {
|
||||
this.getItems();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
handleSearch: function(search) {
|
||||
this.setState({
|
||||
|
@@ -47,7 +47,7 @@ const messages = {
|
||||
} else if (~~response > 1) {
|
||||
message = (
|
||||
MailPoet.I18n.t('multipleSubscribersTrashed')
|
||||
).replace('%$1d', ~~response);
|
||||
).replace('%$1d', (~~response).toLocaleString());
|
||||
}
|
||||
|
||||
if (message !== null) {
|
||||
@@ -83,7 +83,7 @@ const messages = {
|
||||
} else if (~~response > 1) {
|
||||
message = (
|
||||
MailPoet.I18n.t('multipleSubscribersRestored')
|
||||
).replace('%$1d', ~~response);
|
||||
).replace('%$1d', (~~response).toLocaleString());
|
||||
}
|
||||
|
||||
if (message !== null) {
|
||||
@@ -120,7 +120,7 @@ const bulk_actions = [
|
||||
onSuccess: function(response) {
|
||||
MailPoet.Notice.success(
|
||||
MailPoet.I18n.t('multipleSubscribersMovedToList')
|
||||
.replace('%$1d', ~~(response.subscribers))
|
||||
.replace('%$1d', (~~(response.subscribers)).toLocaleString())
|
||||
.replace('%$2s', response.segment)
|
||||
);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ const bulk_actions = [
|
||||
onSuccess: function(response) {
|
||||
MailPoet.Notice.success(
|
||||
MailPoet.I18n.t('multipleSubscribersAddedToList')
|
||||
.replace('%$1d', ~~response.subscribers)
|
||||
.replace('%$1d', (~~response.subscribers).toLocaleString())
|
||||
.replace('%$2s', response.segment)
|
||||
);
|
||||
}
|
||||
@@ -182,7 +182,7 @@ const bulk_actions = [
|
||||
onSuccess: function(response) {
|
||||
MailPoet.Notice.success(
|
||||
MailPoet.I18n.t('multipleSubscribersRemovedFromList')
|
||||
.replace('%$1d', ~~response.subscribers)
|
||||
.replace('%$1d', (~~response.subscribers).toLocaleString())
|
||||
.replace('%$2s', response.segment)
|
||||
);
|
||||
}
|
||||
@@ -193,7 +193,7 @@ const bulk_actions = [
|
||||
onSuccess: function(response) {
|
||||
MailPoet.Notice.success(
|
||||
MailPoet.I18n.t('multipleSubscribersRemovedFromAllLists')
|
||||
.replace('%$1d', ~~response)
|
||||
.replace('%$1d', (~~response).toLocaleString())
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -203,7 +203,7 @@ const bulk_actions = [
|
||||
onSuccess: function(response) {
|
||||
MailPoet.Notice.success(
|
||||
MailPoet.I18n.t('multipleConfirmationEmailsSent')
|
||||
.replace('%$1d', ~~response)
|
||||
.replace('%$1d', (~~response).toLocaleString())
|
||||
);
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user