Customize: Mark newly-added page/post stubs as added (with checkmark) when they are inserted into the list of available items.

Props ryankienstra, celloexpressions.
See #34923.
Fixes #38499.


git-svn-id: https://develop.svn.wordpress.org/trunk@39002 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2016-10-29 05:05:33 +00:00
parent 0599b2d13c
commit 2982ca5872

View File

@ -577,7 +577,7 @@
post_type: itemObject
} );
promise.done( function( data ) {
var availableItem, $content, itemTemplate;
var availableItem, $content, itemElement;
availableItem = new api.Menus.AvailableItemModel( {
'id': 'post-' + data.post_id, // Used for available menu item Backbone models.
'title': itemName.val(),
@ -594,8 +594,9 @@
// Add the new item to the list of available items.
api.Menus.availableMenuItemsPanel.collection.add( availableItem );
$content = container.find( '.available-menu-items-list' );
itemTemplate = wp.template( 'available-menu-item' );
$content.prepend( itemTemplate( availableItem.attributes ) );
itemElement = $( wp.template( 'available-menu-item' )( availableItem.attributes ) );
itemElement.find( '.menu-item-handle:first' ).addClass( 'item-added' );
$content.prepend( itemElement );
$content.scrollTop();
// Reset the create content form.