From 2982ca587289a49a189394c5665ab31c714a6b4c Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sat, 29 Oct 2016 05:05:33 +0000 Subject: [PATCH] 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 --- src/wp-admin/js/customize-nav-menus.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/js/customize-nav-menus.js b/src/wp-admin/js/customize-nav-menus.js index 6024739059..58af669947 100644 --- a/src/wp-admin/js/customize-nav-menus.js +++ b/src/wp-admin/js/customize-nav-menus.js @@ -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.