Add a blank slate area for shop orders

This commit is contained in:
Mike Jolley 2016-06-03 14:07:41 +01:00
parent fa0422a7f0
commit 5cb0d5ed29
3 changed files with 70 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -106,11 +106,8 @@
}
}
.woocommerce-message {
position: relative;
border-left-color: #cc99c2 !important;
overflow: hidden;
.woocommerce-message,
.woocommerce-BlankState {
a.button-primary,
button.button-primary {
background: #bb77ae;
@ -127,6 +124,12 @@
box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 0 #A36597;
}
}
}
.woocommerce-message {
position: relative;
border-left-color: #cc99c2 !important;
overflow: hidden;
a.skip,
a.docs {
@ -4613,6 +4616,37 @@ table.bar_chart {
}
}
.post-type-shop_order {
.woocommerce-BlankState {
text-align: center;
padding: 5em 0 0;
.woocommerce-BlankState-message {
color: #aaa;
margin: 0 0 1.5em 0;
&:before {
@include icon_dashicons( "\f174" );
color: #ddd;
text-shadow: 0 -1px 0 #aaa, 0 1px 0 white;
font-size: 10em;
display: block;
position: relative !important;
top: auto;
left: auto;
line-height: 1em;
margin: 0 0 0.1em 0;
}
}
.woocommerce-BlankState-cta {
font-size: 1.2em;
padding: .75em 1.5em;
height: auto;
}
}
}
/**
* Small screen optimisation
*/

View File

@ -109,6 +109,9 @@ class WC_Admin_Post_Types {
$user = wp_get_current_user();
update_user_option( $user->ID, 'manageedit-shop_ordercolumnshidden', array( 0 => 'billing_address' ), true );
}
// Show blank state
add_action( 'manage_posts_extra_tablenav', array( $this, 'maybe_render_blank_state' ) );
}
/**
@ -2285,7 +2288,6 @@ class WC_Admin_Post_Types {
}
}
/**
* Disable DFW feature pointer.
*/
@ -2310,6 +2312,33 @@ class WC_Admin_Post_Types {
unset( $post_types['product'], $post_types['shop_order'], $post_types['shop_coupon'] );
return $post_types;
}
public function maybe_render_blank_state( $which ) {
global $post_type;
if ( 'shop_order' === $post_type && 'bottom' === $which ) {
$counts = (array) wp_count_posts( 'shop_order' );
unset( $counts['auto-draft'] );
$count = array_sum( $counts );
if ( 0 === $count ) {
?>
<div class="woocommerce-BlankState">
<h2 class="woocommerce-BlankState-message"><?php _e( 'When you receive a new order, it will appear here.', 'woocommerce' ); ?></h2>
<a class="woocommerce-BlankState-cta button-primary button" target="_blank" href="https://docs.woothemes.com/document/managing-orders/"><?php _e( 'Learn more about orders', 'woocommerce' ); ?></a>
<style type="text/css">
#posts-filter .wp-list-table,
#posts-filter .tablenav.top,
.wrap .subsubsub {
display: none;
}
</style>
</div>
<?php
}
}
}
}
endif;