New template for empty set.

This commit is contained in:
George Stephanis 2015-08-12 15:29:17 -04:00
parent 4e2229a6bf
commit f77b77e335
2 changed files with 15 additions and 4 deletions

View File

@ -13,6 +13,7 @@
}
var rowTemplate = wp.template( 'wc-tax-table-row' ),
rowTemplateEmpty = wp.template( 'wc-tax-table-row-empty' ),
paginationTemplate = wp.template( 'wc-tax-table-pagination' ),
$table = $( '.wc_tax_rates' ),
$tbody = $( '#rates' ),
@ -64,10 +65,14 @@
// Blank out the contents.
this.$el.empty();
// Populate $tbody with the current page of results.
$.each( paged_rates, function ( id, rowData ) {
view.$el.append( view.rowTemplate( rowData ) );
});
if ( paged_rates.length ) {
// Populate $tbody with the current page of results.
$.each( paged_rates, function ( id, rowData ) {
view.$el.append( view.rowTemplate( rowData ) );
} );
} else {
view.$el.append( rowTemplateEmpty() );
}
// Initialize autocomplete for countries.
this.$el.find( 'td.country input' ).autocomplete({

View File

@ -93,6 +93,12 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr>
</script>
<script type="text/html" id="tmpl-wc-tax-table-row-empty">
<tr>
<th colspan="10" style="text-align:center"><?php esc_html_e( 'No Matching Tax Rates Found.', 'woocommerce' ); ?></th>
</tr>
</script>
<script type="text/html" id="tmpl-wc-tax-table-pagination">
<div class="tablenav">
<div class="tablenav-pages">