Nav menus: Provide visual feedback when attempting to add an empty custom link.

props pragunbhutani for the initial patch.
fixes #18517.


git-svn-id: https://develop.svn.wordpress.org/trunk@32690 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Helen Hou-Sandi 2015-06-04 04:30:04 +00:00
parent e069a38598
commit 112fc6d369
1 changed files with 5 additions and 1 deletions

View File

@ -817,6 +817,8 @@ var wpNavMenu;
} }
}); });
$('#add-custom-links input[type="text"]').keypress(function(e){ $('#add-custom-links input[type="text"]').keypress(function(e){
$('#customlinkdiv').removeClass('form-invalid');
if ( e.keyCode === 13 ) { if ( e.keyCode === 13 ) {
e.preventDefault(); e.preventDefault();
$( '#submit-customlinkdiv' ).click(); $( '#submit-customlinkdiv' ).click();
@ -919,8 +921,10 @@ var wpNavMenu;
processMethod = processMethod || api.addMenuItemToBottom; processMethod = processMethod || api.addMenuItemToBottom;
if ( '' === url || 'http://' == url ) if ( '' === url || 'http://' == url ) {
$('#customlinkdiv').addClass('form-invalid');
return false; return false;
}
// Show the ajax spinner // Show the ajax spinner
$( '.customlinkdiv .spinner' ).addClass( 'is-active' ); $( '.customlinkdiv .spinner' ).addClass( 'is-active' );