streamline product edit metabox when no suggestions are visible:

- hide title (animate slide up)
- trigger this after dismiss, so we're not left with a heading
and no content
This commit is contained in:
haszari 2019-03-05 10:38:11 +13:00
parent 06b5b89336
commit 8b0672f6cf
1 changed files with 11 additions and 4 deletions

View File

@ -22,6 +22,7 @@
var selector = '[data-suggestion-slug=' + suggestionSlug + ']';
$( selector ).fadeOut( function() {
$( this ).remove();
tidyProductEditMetabox();
} );
// save dismissal in user settings
@ -284,11 +285,16 @@
$( '.marketplace-suggestions-container[data-marketplace-suggestions-context="orders-list-empty-header"]' ).hide();
$( '.marketplace-suggestions-container[data-marketplace-suggestions-context="orders-list-empty-footer"]' ).hide();
}
}
var showingProductMetaboxSuggestions = _.contains( usedSuggestionsContexts, 'product-edit-meta-tab-body' );
if ( ! showingProductMetaboxSuggestions ) {
$( '.marketplace-suggestions_options.marketplace-suggestions_tab' ).hide();
$( '#marketplace_suggestions.panel.woocommerce_options_panel' ).hide();
// Streamline the product edit suggestions tab dependent on what's visible.
function tidyProductEditMetabox() {
var productMetaboxSuggestions = $(
'.marketplace-suggestions-container[data-marketplace-suggestions-context="product-edit-meta-tab-body"]'
).children();
if ( 0 >= productMetaboxSuggestions.length ) {
$( '.marketplace-suggestions-container[data-marketplace-suggestions-context="product-edit-meta-tab-header"]' ).slideUp();
$( '.marketplace-suggestions-container[data-marketplace-suggestions-context="product-edit-meta-tab-body"]' ).fadeOut();
}
}
@ -404,6 +410,7 @@
}
hidePageElementsForSuggestionState( usedSuggestionsContexts );
tidyProductEditMetabox();
}
if ( marketplace_suggestions.suggestions_data ) {