refactored bulk actions & implemented bulk trash for all listings
This commit is contained in:
@@ -276,7 +276,11 @@ define(
|
||||
this.props.messages['created']();
|
||||
}
|
||||
} else {
|
||||
this.setState({ errors: response });
|
||||
if(response === false) {
|
||||
// unknown error occurred
|
||||
} else {
|
||||
this.setState({ errors: response });
|
||||
}
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
@@ -241,12 +241,12 @@ define(
|
||||
|
||||
var data = params || {};
|
||||
|
||||
data.selection = selected_ids;
|
||||
data.listing = {
|
||||
offset: 0,
|
||||
limit: 0,
|
||||
group: this.state.group,
|
||||
search: this.state.search
|
||||
search: this.state.search,
|
||||
selection: selected_ids
|
||||
}
|
||||
|
||||
MailPoet.Ajax.post({
|
||||
|
@@ -27,6 +27,13 @@ define(
|
||||
}
|
||||
];
|
||||
|
||||
var bulk_actions = [
|
||||
{
|
||||
name: 'trash',
|
||||
label: 'Trash'
|
||||
}
|
||||
];
|
||||
|
||||
var NewsletterList = React.createClass({
|
||||
renderItem: function(newsletter, actions) {
|
||||
var rowClasses = classNames(
|
||||
@@ -57,8 +64,8 @@ define(
|
||||
<Listing
|
||||
endpoint="newsletters"
|
||||
onRenderItem={this.renderItem}
|
||||
items={this.getItems}
|
||||
columns={columns} />
|
||||
columns={columns}
|
||||
bulk_actions={ bulk_actions } />
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@@ -27,6 +27,13 @@ define(
|
||||
}
|
||||
];
|
||||
|
||||
var bulk_actions = [
|
||||
{
|
||||
name: 'trash',
|
||||
label: 'Trash'
|
||||
}
|
||||
];
|
||||
|
||||
var SegmentList = React.createClass({
|
||||
renderItem: function(segment, actions) {
|
||||
var rowClasses = classNames(
|
||||
@@ -57,8 +64,8 @@ define(
|
||||
<Listing
|
||||
endpoint="segments"
|
||||
onRenderItem={this.renderItem}
|
||||
items={this.getItems}
|
||||
columns={columns} />
|
||||
columns={columns}
|
||||
bulk_actions={ bulk_actions } />
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@@ -67,7 +67,7 @@ define(
|
||||
action: 'listing',
|
||||
data: {
|
||||
'offset': 0,
|
||||
'limit': 5,
|
||||
'limit': 100,
|
||||
'search': '',
|
||||
'sort_by': 'name',
|
||||
'sort_order': 'asc'
|
||||
@@ -145,7 +145,7 @@ define(
|
||||
|
||||
var bulk_actions = [
|
||||
{
|
||||
name: 'move',
|
||||
name: 'moveToList',
|
||||
label: 'Move to list...',
|
||||
onSelect: function() {
|
||||
return (
|
||||
@@ -161,7 +161,7 @@ define(
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'add',
|
||||
name: 'addToList',
|
||||
label: 'Add to list...',
|
||||
onSelect: function() {
|
||||
return (
|
||||
@@ -177,7 +177,7 @@ define(
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'remove',
|
||||
name: 'removeFromList',
|
||||
label: 'Remove from list...',
|
||||
onSelect: function() {
|
||||
return (
|
||||
@@ -198,7 +198,7 @@ define(
|
||||
}
|
||||
];
|
||||
|
||||
var List = React.createClass({
|
||||
var SubscriberList = React.createClass({
|
||||
renderItem: function(subscriber, actions) {
|
||||
var row_classes = classNames(
|
||||
'manage-column',
|
||||
@@ -259,6 +259,6 @@ define(
|
||||
}
|
||||
});
|
||||
|
||||
return List;
|
||||
return SubscriberList;
|
||||
}
|
||||
);
|
Reference in New Issue
Block a user