- Formats all numbers >1000 to use comma
- Removes subscriber count from segments if its === 0 Fixes #431
This commit is contained in:
@ -21,7 +21,7 @@ define(['react', 'classnames'], function(React, classNames) {
|
||||
href="javascript:;"
|
||||
className={classes}
|
||||
onClick={this.handleSelect.bind(this, group.name)} >
|
||||
{group.label} <span className="count">({ group.count })</span>
|
||||
{group.label} <span className="count">({ group.count.toLocaleString() })</span>
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
|
@ -148,7 +148,7 @@ define([
|
||||
className="current-page" />
|
||||
{MailPoet.I18n.t('pageOutOf')}
|
||||
<span className="total-pages">
|
||||
{Math.ceil(this.props.count / this.props.limit)}
|
||||
{Math.ceil(this.props.count / this.props.limit).toLocaleString()}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
@ -167,7 +167,7 @@ define([
|
||||
return (
|
||||
<div className={ classes }>
|
||||
<span className="displaying-num">{
|
||||
MailPoet.I18n.t('numberOfItems').replace('%$1d', this.props.count)
|
||||
MailPoet.I18n.t('numberOfItems').replace('%$1d', this.props.count.toLocaleString())
|
||||
}</span>
|
||||
{ pagination }
|
||||
</div>
|
||||
|
@ -165,7 +165,11 @@ const SegmentList = React.createClass({
|
||||
'manage-column',
|
||||
'column-primary',
|
||||
'has-row-actions'
|
||||
);
|
||||
),
|
||||
subscribed = segment.subscribers_count.subscribed || 0,
|
||||
unconfirmed = segment.subscribers_count.unconfirmed || 0,
|
||||
unsubscribed = segment.subscribers_count.unsubscribed || 0;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<td className={ rowClasses }>
|
||||
@ -178,13 +182,13 @@ const SegmentList = React.createClass({
|
||||
<abbr>{ segment.description }</abbr>
|
||||
</td>
|
||||
<td className="column-date" data-colname="Subscribed">
|
||||
<abbr>{ segment.subscribers_count.subscribed || 0 }</abbr>
|
||||
<abbr>{ parseInt(subscribed).toLocaleString() }</abbr>
|
||||
</td>
|
||||
<td className="column-date" data-colname="Unconfirmed">
|
||||
<abbr>{ segment.subscribers_count.unconfirmed || 0 }</abbr>
|
||||
<abbr>{ parseInt(unconfirmed).toLocaleString() }</abbr>
|
||||
</td>
|
||||
<td className="column-date" data-colname="Unsubscribed">
|
||||
<abbr>{ segment.subscribers_count.unsubscribed || 0 }</abbr>
|
||||
<abbr>{ parseInt(unsubscribed).toLocaleString() }</abbr>
|
||||
</td>
|
||||
<td className="column-date" data-colname="Created on">
|
||||
<abbr>{ MailPoet.Date.full(segment.created_at) }</abbr>
|
||||
|
@ -490,7 +490,7 @@ define(
|
||||
),
|
||||
invalid: (subscribers.invalid.length)
|
||||
? MailPoet.I18n.t('importNoticeInvalid')
|
||||
.replace('%1$s', '<strong>' + subscribers.invalid.length + '</strong>')
|
||||
.replace('%1$s', '<strong>' + subscribers.invalid.length.toLocaleString() + '</strong>')
|
||||
.replace('%2$s', subscribers.invalid.join(', '))
|
||||
: null,
|
||||
duplicate: (subscribers.duplicate.length)
|
||||
@ -533,13 +533,15 @@ define(
|
||||
data: segments,
|
||||
width: '20em',
|
||||
templateResult: function (item) {
|
||||
item.subscriberCount = parseInt(item.subscriberCount);
|
||||
return (item.subscriberCount > 0)
|
||||
? item.name + ' (' + item.subscriberCount + ')'
|
||||
? item.name + ' (' + item.subscriberCount.toLocaleString() + ')'
|
||||
: item.name;
|
||||
},
|
||||
templateSelection: function (item) {
|
||||
item.subscriberCount = parseInt(item.subscriberCount);
|
||||
return (item.subscriberCount > 0)
|
||||
? item.name + ' (' + item.subscriberCount + ')'
|
||||
? item.name + ' (' + item.subscriberCount.toLocaleString() + ')'
|
||||
: item.name;
|
||||
}
|
||||
})
|
||||
@ -1140,12 +1142,12 @@ define(
|
||||
importResults = {
|
||||
created: (importData.step2.created)
|
||||
? MailPoet.I18n.t('subscribersCreated')
|
||||
.replace('%1$s', '<strong>' + importData.step2.created + '</strong>')
|
||||
.replace('%1$s', '<strong>' + importData.step2.created.toLocaleString() + '</strong>')
|
||||
.replace('%2$s', '"' + importData.step2.segments.join('", "') + '"')
|
||||
: false,
|
||||
updated: (importData.step2.updated)
|
||||
? MailPoet.I18n.t('subscribersUpdated')
|
||||
.replace('%1$s', '<strong>' + importData.step2.updated + '</strong>')
|
||||
.replace('%1$s', '<strong>' + importData.step2.updated.toLocaleString() + '</strong>')
|
||||
.replace('%2$s', '"' + importData.step2.segments.join('", "') + '"')
|
||||
: false,
|
||||
noaction: (!importData.step2.updated && !importData.step2.created)
|
||||
|
@ -108,7 +108,9 @@ const bulk_actions = [
|
||||
);
|
||||
},
|
||||
getLabel: function (segment) {
|
||||
return segment.name + ' (' + segment.subscribers + ')';
|
||||
return (segment.subscribers > 0) ?
|
||||
segment.name + ' (' + parseInt(segment.subscribers).toLocaleString() + ')' :
|
||||
segment.name;
|
||||
}
|
||||
};
|
||||
|
||||
@ -142,7 +144,9 @@ const bulk_actions = [
|
||||
);
|
||||
},
|
||||
getLabel: function (segment) {
|
||||
return segment.name + ' (' + segment.subscribers + ')';
|
||||
return (segment.subscribers > 0) ?
|
||||
segment.name + ' (' + parseInt(segment.subscribers).toLocaleString() + ')' :
|
||||
segment.name;
|
||||
}
|
||||
};
|
||||
|
||||
@ -176,7 +180,9 @@ const bulk_actions = [
|
||||
);
|
||||
},
|
||||
getLabel: function (segment) {
|
||||
return segment.name + ' (' + segment.subscribers + ')';
|
||||
return (segment.subscribers > 0) ?
|
||||
segment.name + ' (' + parseInt(segment.subscribers).toLocaleString() + ')' :
|
||||
segment.name;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -192,11 +192,14 @@ class Subscriber extends Model {
|
||||
'label' => __('All segments'),
|
||||
'value' => ''
|
||||
);
|
||||
|
||||
$subscribers_without_segment = self::filter('withoutSegments')->count();
|
||||
$subscribers_without_segment_label = sprintf(
|
||||
__('Subscribers without a segment (%s)'),
|
||||
number_format($subscribers_without_segment)
|
||||
);
|
||||
$segment_list[] = array(
|
||||
'label' => sprintf(
|
||||
__('Subscribers without a segment (%d)'),
|
||||
self::filter('withoutSegments')->count()
|
||||
),
|
||||
'label' => str_replace(' (0)', '', $subscribers_without_segment_label),
|
||||
'value' => 'none'
|
||||
);
|
||||
|
||||
@ -205,8 +208,9 @@ class Subscriber extends Model {
|
||||
->filter('groupBy', $group)
|
||||
->count();
|
||||
|
||||
$label = sprintf('%s (%s)', $segment->name, number_format($subscribers_count));
|
||||
$segment_list[] = array(
|
||||
'label' => sprintf('%s (%d)', $segment->name, $subscribers_count),
|
||||
'label' => str_replace(' (0)', '', $label),
|
||||
'value' => $segment->id()
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user