Add SubscribersLimitNotice to mailpoet-segments page
[MAILPOET-2626]
This commit is contained in:
committed by
Jack Kitterhing
parent
f7a1f63a28
commit
eba441f4c1
@ -3,6 +3,7 @@ import { Link } from 'react-router-dom';
|
||||
import MailPoet from 'mailpoet';
|
||||
import Form from 'form/form.jsx';
|
||||
import PropTypes from 'prop-types';
|
||||
import SubscribersLimitNotice from 'notices/subscribers_limit_notice.jsx';
|
||||
|
||||
const fields = [
|
||||
{
|
||||
@ -37,6 +38,8 @@ const SegmentForm = (props) => (
|
||||
<Link className="page-title-action" to="/">{MailPoet.I18n.t('backToList')}</Link>
|
||||
</h1>
|
||||
|
||||
<SubscribersLimitNotice />
|
||||
|
||||
<Form
|
||||
endpoint="segments"
|
||||
fields={fields}
|
||||
|
@ -5,6 +5,7 @@ import classNames from 'classnames';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import Listing from 'listing/listing.jsx';
|
||||
import SubscribersLimitNotice from 'notices/subscribers_limit_notice.jsx';
|
||||
|
||||
const isWPUsersSegment = (segment) => segment.type === 'wp_users';
|
||||
const isWooCommerceCustomersSegment = (segment) => segment.type === 'woocommerce_users';
|
||||
@ -298,6 +299,8 @@ class SegmentList extends React.Component {
|
||||
<Link className="page-title-action" to="/new">{MailPoet.I18n.t('new')}</Link>
|
||||
</h1>
|
||||
|
||||
<SubscribersLimitNotice />
|
||||
|
||||
<Listing
|
||||
limit={window.mailpoet_listing_per_page}
|
||||
location={this.props.location}
|
||||
|
@ -4,6 +4,8 @@ namespace MailPoet\AdminPages\Pages;
|
||||
|
||||
use MailPoet\AdminPages\PageRenderer;
|
||||
use MailPoet\Listing\PageLimit;
|
||||
use MailPoet\Models\Subscriber;
|
||||
use MailPoet\Util\License\Features\Subscribers as SubscribersFeature;
|
||||
|
||||
class Segments {
|
||||
/** @var PageRenderer */
|
||||
@ -12,14 +14,24 @@ class Segments {
|
||||
/** @var PageLimit */
|
||||
private $listingPageLimit;
|
||||
|
||||
public function __construct(PageRenderer $pageRenderer, PageLimit $listingPageLimit) {
|
||||
/** @var SubscribersFeature */
|
||||
private $subscribersFeature;
|
||||
|
||||
public function __construct(PageRenderer $pageRenderer, PageLimit $listingPageLimit, SubscribersFeature $subscribersFeature) {
|
||||
$this->pageRenderer = $pageRenderer;
|
||||
$this->listingPageLimit = $listingPageLimit;
|
||||
$this->subscribersFeature = $subscribersFeature;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
$data = [];
|
||||
$data['items_per_page'] = $this->listingPageLimit->getLimitPerPage('segments');
|
||||
|
||||
$data['subscribers_limit'] = $this->subscribersFeature->getSubscribersLimit();
|
||||
$data['subscribers_limit_reached'] = $this->subscribersFeature->check();
|
||||
$data['has_valid_api_key'] = $this->subscribersFeature->hasValidApiKey();
|
||||
$data['subscriber_count'] = Subscriber::getTotalSubscribers();
|
||||
|
||||
$this->pageRenderer->displayPage('segments.html', $data);
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,10 @@
|
||||
'57f47ca3c697914f21035256',
|
||||
'5d4beee42c7d3a330e3c4207',
|
||||
];
|
||||
var mailpoet_subscribers_limit = <%= subscribers_limit ? subscribers_limit : 'false' %>;
|
||||
var mailpoet_subscribers_limit_reached = <%= subscribers_limit_reached ? 'true' : 'false' %>;
|
||||
var mailpoet_has_valid_api_key = <%= has_valid_api_key ? 'true' : 'false' %>;
|
||||
var mailpoet_subscribers_count = <%= subscriber_count %>;
|
||||
</script>
|
||||
<% endblock %>
|
||||
|
||||
|
Reference in New Issue
Block a user