From 3d69830d4531eded5646be9a7680d99f19251bf6 Mon Sep 17 00:00:00 2001 From: Jonathan Labreuille Date: Tue, 25 Aug 2015 19:23:37 +0200 Subject: [PATCH] fixed pagination for 1 page results --- assets/js/src/subscribers/listing.jsx | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/assets/js/src/subscribers/listing.jsx b/assets/js/src/subscribers/listing.jsx index def466c550..ab2930fbb1 100644 --- a/assets/js/src/subscribers/listing.jsx +++ b/assets/js/src/subscribers/listing.jsx @@ -88,7 +88,8 @@ define('subscribers.listing', if(this.props.count === 0) { return (
); } else { - var firstPage = ( + var pagination, + firstPage = ( ), previousPage = ( @@ -111,7 +112,7 @@ define('subscribers.listing', ); - }var last_page = Math.ceil(this.props.count / this.props.limit); + } if(this.props.page > 2) { firstPage = ( @@ -145,12 +146,8 @@ define('subscribers.listing', ); } - } - - return ( -
- {this.props.count} item(s) + pagination = ( {firstPage} {previousPage} @@ -178,6 +175,18 @@ define('subscribers.listing', {nextPage} {lastPage} + ); + } + + var classes = classNames( + 'tablenav-pages', + { 'one-page': (this.props.count <= this.props.limit) } + ); + + return ( +
+ { this.props.count } item(s) + { pagination }
); }