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

props pragunbhutani for the initial patch.
fixes #18517.

Built from https://develop.svn.wordpress.org/trunk@32690


git-svn-id: http://core.svn.wordpress.org/trunk@32660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2015-06-04 04:31:26 +00:00
parent acec5066f6
commit 9d0ab29bc4
3 changed files with 7 additions and 3 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' );

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.3-alpha-32689'; $wp_version = '4.3-alpha-32690';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.