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:
parent
0599b2d13c
commit
2982ca5872
@ -577,7 +577,7 @@
|
|||||||
post_type: itemObject
|
post_type: itemObject
|
||||||
} );
|
} );
|
||||||
promise.done( function( data ) {
|
promise.done( function( data ) {
|
||||||
var availableItem, $content, itemTemplate;
|
var availableItem, $content, itemElement;
|
||||||
availableItem = new api.Menus.AvailableItemModel( {
|
availableItem = new api.Menus.AvailableItemModel( {
|
||||||
'id': 'post-' + data.post_id, // Used for available menu item Backbone models.
|
'id': 'post-' + data.post_id, // Used for available menu item Backbone models.
|
||||||
'title': itemName.val(),
|
'title': itemName.val(),
|
||||||
@ -594,8 +594,9 @@
|
|||||||
// Add the new item to the list of available items.
|
// Add the new item to the list of available items.
|
||||||
api.Menus.availableMenuItemsPanel.collection.add( availableItem );
|
api.Menus.availableMenuItemsPanel.collection.add( availableItem );
|
||||||
$content = container.find( '.available-menu-items-list' );
|
$content = container.find( '.available-menu-items-list' );
|
||||||
itemTemplate = wp.template( 'available-menu-item' );
|
itemElement = $( wp.template( 'available-menu-item' )( availableItem.attributes ) );
|
||||||
$content.prepend( itemTemplate( availableItem.attributes ) );
|
itemElement.find( '.menu-item-handle:first' ).addClass( 'item-added' );
|
||||||
|
$content.prepend( itemElement );
|
||||||
$content.scrollTop();
|
$content.scrollTop();
|
||||||
|
|
||||||
// Reset the create content form.
|
// Reset the create content form.
|
||||||
|
Loading…
Reference in New Issue
Block a user