fixed total count and filtering + basic tab implementation in React

This commit is contained in:
Jonathan Labreuille
2016-06-02 16:59:23 +02:00
parent 86a2846215
commit c959e7ec96
6 changed files with 57 additions and 26 deletions

View File

@@ -540,6 +540,7 @@ define(
var data = params || {};
data.listing = {
tab: (this.props.tab) ? this.props.tab : '',
offset: 0,
limit: 0,
filter: this.state.filter,

View File

@@ -250,13 +250,6 @@ define(
return segment.name
}).join(', ');
var statistics_column =
(!mailpoet_settings.tracking || !mailpoet_settings.tracking.enabled) ?
false :
<td className="column {statistics_class}" data-colname={ MailPoet.I18n.t('statistics') }>
{ this.renderStatistics(newsletter) }
</td>;
return (
<div>
<td className={ rowClasses }>
@@ -271,7 +264,9 @@ define(
<td className="column" data-colname={ MailPoet.I18n.t('lists') }>
{ segments }
</td>
{ statistics_column }
<td className="column" data-colname={ MailPoet.I18n.t('statistics') }>
{ this.renderStatistics(newsletter) }
</td>
<td className="column-date" data-colname={ MailPoet.I18n.t('createdOn') }>
<abbr>{ MailPoet.Date.format(newsletter.created_at) }</abbr>
</td>
@@ -282,15 +277,24 @@ define(
);
},
render: function() {
if (!mailpoet_settings.tracking || !mailpoet_settings.tracking.enabled) {
columns = _.without(columns, _.findWhere(columns, {name: 'statistics'}));
}
return (
<div>
<h1 className="title">
{MailPoet.I18n.t('pageTitle')} <Link className="page-title-action" to="/new">{MailPoet.I18n.t('new')}</Link>
</h1>
<h2 className="nav-tab-wrapper">
<Link to="/standard" className="nav-tab nav-tab-active">
{ MailPoet.I18n.t('tabStandardTitle') }
</Link>
<Link to="/welcome" className="nav-tab">
{ MailPoet.I18n.t('tabWelcomeTitle') }
</Link>
<Link to="/notification" className="nav-tab">
{ MailPoet.I18n.t('tabNotificationTitle') }
</Link>
</h2>
<Listing
limit={ mailpoet_listing_per_page }
params={ this.props.params }

View File

@@ -25,13 +25,21 @@ if(container) {
<Router history={ history }>
<Route path="/" component={ App }>
<IndexRoute component={ NewsletterList } />
{/* New newsletters */}
<Route path="new" component={ NewsletterTypes } />
<Route name="standard" path="new/standard" component={ NewsletterStandard } />
<Route name="welcome" path="new/welcome" component={ NewsletterWelcome } />
<Route name="notification" path="new/notification" component={ NewsletterNotification } />
<Route name="new/standard" path="new/standard" component={ NewsletterStandard } />
<Route name="new/welcome" path="new/welcome" component={ NewsletterWelcome } />
<Route name="new/notification" path="new/notification" component={ NewsletterNotification } />
{/* Form: template selection */}
<Route name="template" path="template/:id" component={ NewsletterTemplates } />
<Route path="send/:id" component={ NewsletterSend } />
{/* Listing: tabs */}
<Route name="listing/standard" path="standard" component={ NewsletterList } />
<Route name="listing/welcome" path="welcome" component={ NewsletterList } />
<Route name="listing/notification" path="notification" component={ NewsletterList } />
{/* Listing: filtering */}
<Route path="filter[:filter]" component={ NewsletterList } />
{/* Form: sending options */}
<Route path="send/:id" component={ NewsletterSend } />
<Route path="*" component={ NewsletterList } />
</Route>
</Router>