Add a Premium page link to bounced subscribers listing [MAILPOET-887]

This commit is contained in:
stoletniy
2017-05-22 11:16:00 +03:00
parent 65ff14a81d
commit 58faf64a5c
4 changed files with 33 additions and 5 deletions

View File

@@ -198,6 +198,17 @@ const ListingItem = React.createClass({
const ListingItems = React.createClass({
render: function() {
if (this.props.items.length === 0) {
let message;
if (this.props.loading === true) {
message = (this.props.messages.onLoadingItems
&& this.props.messages.onLoadingItems(this.props.group))
|| MailPoet.I18n.t('loadingItems');
} else {
message = (this.props.messages.onNoItemsFound
&& this.props.messages.onNoItemsFound(this.props.group))
|| MailPoet.I18n.t('noItemsFound');
}
return (
<tbody>
<tr className="no-items">
@@ -207,11 +218,7 @@ const ListingItems = React.createClass({
+ (this.props.is_selectable ? 1 : 0)
}
className="colspanchange">
{
(this.props.loading === true)
? (this.props.messages.onLoadingItems || MailPoet.I18n.t('loadingItems'))
: (this.props.messages.onNoItemsFound || MailPoet.I18n.t('noItemsFound'))
}
{message}
</td>
</tr>
</tbody>

View File

@@ -81,6 +81,22 @@ const messages = {
).replace('%$1d', count.toLocaleString());
}
MailPoet.Notice.success(message);
},
onNoItemsFound: (group) => {
if (group === 'bounced' && !mailpoet_premium_active) {
return (
<div>
<p>{MailPoet.I18n.t('bouncedSubscribersHelp')}</p>
<p>
<a href={ `admin.php?page=mailpoet-premium` } className="button-primary">
{MailPoet.I18n.t('bouncedSubscribersPremiumButtonText')}
</a>
</p>
</div>
);
}
// use default message
return false;
}
};

View File

@@ -378,6 +378,8 @@ class Menu {
$data['date_formats'] = Block\Date::getDateFormats();
$data['month_names'] = Block\Date::getMonthNames();
$data['premium_plugin_active'] = License::getLicense();
$this->displayPage('subscribers/subscribers.html', $data);
}

View File

@@ -9,6 +9,7 @@
var mailpoet_custom_fields = <%= json_encode(custom_fields) %>;
var mailpoet_month_names = <%= json_encode(month_names) %>;
var mailpoet_date_formats = <%= json_encode(date_formats) %>;
var mailpoet_premium_active = <%= json_encode(premium_plugin_active) %>;
</script>
<% endblock %>
@@ -18,6 +19,8 @@
'searchLabel': __('Search'),
'loadingItems': __('Loading subscribers...'),
'noItemsFound': __('No subscribers were found.'),
'bouncedSubscribersHelp': __("Emails that are invalid or don't exist anymore are called \"bounced addresses\". It's a good practice not to send emails to bounced addresses to keep a good reputation with spam filters. Send your emails with MailPoet and we'll automatically ensure to keep a list of bounced addresses without any setup."),
'bouncedSubscribersPremiumButtonText': __('Check out the Premium'),
'selectAllLabel': __('All subscribers on this page are selected.'),
'selectedAllLabel': __('All %d subscribers are selected.'),
'selectAllLink': __('Select all subscribers on all pages.'),