Nav Menus: Delegate click events for move links.

props ankit.gade.
fixes #25594.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-12-04 17:10:11 +00:00
parent 10f58cded3
commit bfc16271ca
2 changed files with 11 additions and 9 deletions

View File

@ -379,27 +379,29 @@ var wpNavMenu;
}, },
initAccessibility : function() { initAccessibility : function() {
var menu = $( '#menu-to-edit' );
api.refreshKeyboardAccessibility(); api.refreshKeyboardAccessibility();
api.refreshAdvancedAccessibility(); api.refreshAdvancedAccessibility();
// Events // Events
$( '.menus-move-up' ).on( 'click', function ( e ) { menu.on( 'click', '.menus-move-up', function ( e ) {
api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'up' ); api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'up' );
e.preventDefault(); e.preventDefault();
}); })
$( '.menus-move-down' ).on( 'click', function ( e ) { menu.on( 'click', '.menus-move-down', function ( e ) {
api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'down' ); api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'down' );
e.preventDefault(); e.preventDefault();
}); })
$( '.menus-move-top' ).on( 'click', function ( e ) { menu.on( 'click', '.menus-move-top', function ( e ) {
api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'top' ); api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'top' );
e.preventDefault(); e.preventDefault();
}); })
$( '.menus-move-left' ).on( 'click', function ( e ) { menu.on( 'click', '.menus-move-left', function ( e ) {
api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'left' ); api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'left' );
e.preventDefault(); e.preventDefault();
}); });
$( '.menus-move-right' ).on( 'click', function ( e ) { menu.on( 'click', '.menus-move-right', function ( e ) {
api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'right' ); api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'right' );
e.preventDefault(); e.preventDefault();
}); });

File diff suppressed because one or more lines are too long