Merge pull request #23229 from woocommerce/add/manage-suggestions-metabox-link

[3.6] Add manage suggestions link into browse-all metabox footer
This commit is contained in:
Timmy Crawford 2019-04-08 13:59:35 -07:00 committed by GitHub
commit 7ac179f7b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -157,6 +157,10 @@ a.suggestion-dismiss::before {
text-align: left;
}
.marketplace-suggestion-container-content.has-manage-link {
text-align: right;
}
}
}

View File

@ -153,7 +153,7 @@
}
// Render DOM elements for suggestion content.
function renderSuggestionContent( title, copy ) {
function renderSuggestionContent( slug, title, copy ) {
var container = document.createElement( 'div' );
container.classList.add( 'marketplace-suggestion-container-content' );
@ -170,6 +170,26 @@
container.appendChild( body );
}
// Conditionally add in a Manage suggestions link to product edit
// metabox footer (based on suggestion slug).
var slugsWithManage = [
'product-edit-empty-footer-browse-all',
'product-edit-meta-tab-footer-browse-all'
];
if ( -1 !== slugsWithManage.indexOf( slug ) ) {
container.classList.add( 'has-manage-link' );
var manageSuggestionsLink = document.createElement( 'a' );
manageSuggestionsLink.classList.add( 'marketplace-suggestion-manage-link', 'linkout' );
manageSuggestionsLink.setAttribute(
'href',
'/wp-admin/admin.php?page=wc-settings&tab=account#marketplace_suggestions-description'
);
manageSuggestionsLink.textContent = marketplace_suggestions.i18n_marketplace_suggestions_manage_suggestions;
container.appendChild( manageSuggestionsLink );
}
return container;
}
@ -206,7 +226,7 @@
container.appendChild( icon );
}
container.appendChild(
renderSuggestionContent( title, copy )
renderSuggestionContent( slug, title, copy )
);
container.appendChild(
renderSuggestionCTA( context, product, promoted, slug, url, linkText, linkIsButton, allowDismiss )

File diff suppressed because one or more lines are too long

View File

@ -446,6 +446,8 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
=> esc_html__( 'Learn More', 'woocommerce' ),
'i18n_marketplace_suggestions_dismiss_tooltip'
=> esc_attr__( 'Dismiss this suggestion', 'woocommerce' ),
'i18n_marketplace_suggestions_manage_suggestions'
=> esc_html__( 'Manage suggestions', 'woocommerce' ),
)
);
wp_enqueue_script( 'marketplace-suggestions' );