Do not load window.onbeforeonload event if we are not on an existing nav menu. props filosofo. Reduce opacity on nav menu postboxes if we are not on an existing nav menu, and for JS users, deactivate all links and form elements, to make it obvious that those UI elements are not usable at this stage. fixes #13615
git-svn-id: http://svn.automattic.com/wordpress/trunk@15062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d69536a671
commit
7aa4551ec7
File diff suppressed because one or more lines are too long
|
@ -34,6 +34,10 @@ body {
|
||||||
padding:0 10px;
|
padding:0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.metabox-holder-disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
#wpbody {
|
#wpbody {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,10 @@ var wpNavMenu;
|
||||||
* @param jQuery metabox The metabox jQuery object.
|
* @param jQuery metabox The metabox jQuery object.
|
||||||
*/
|
*/
|
||||||
addSelectedToMenu : function(processMethod) {
|
addSelectedToMenu : function(processMethod) {
|
||||||
|
if ( 0 == $('#menu-to-edit').length ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
var t = $(this), menuItems = {},
|
var t = $(this), menuItems = {},
|
||||||
checkboxes = t.find('.tabs-panel-active .categorychecklist li input:checked'),
|
checkboxes = t.find('.tabs-panel-active .categorychecklist li input:checked'),
|
||||||
|
@ -555,10 +559,16 @@ var wpNavMenu;
|
||||||
$('#menu-management input, #menu-management select, #menu-management, #menu-management textarea').change(function(){
|
$('#menu-management input, #menu-management select, #menu-management, #menu-management textarea').change(function(){
|
||||||
api.registerChange();
|
api.registerChange();
|
||||||
});
|
});
|
||||||
window.onbeforeunload = function(){
|
|
||||||
if ( api.menusChanged )
|
if ( 0 != $('#menu-to-edit').length ) {
|
||||||
return navMenuL10n.saveAlert;
|
window.onbeforeunload = function(){
|
||||||
};
|
if ( api.menusChanged )
|
||||||
|
return navMenuL10n.saveAlert;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Make the post boxes read-only, as they can't be used yet
|
||||||
|
$('#menu-settings-column').find('input,select').attr('disabled', 'disabled').end().find('a').attr('href', '#').unbind('click');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
registerChange : function() {
|
registerChange : function() {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -456,7 +456,7 @@ require_once( 'admin-header.php' );
|
||||||
endforeach;
|
endforeach;
|
||||||
?>
|
?>
|
||||||
<div id="nav-menus-frame">
|
<div id="nav-menus-frame">
|
||||||
<div id="menu-settings-column" class="metabox-holder">
|
<div id="menu-settings-column" class="metabox-holder<?php if ( !$nav_menu_selected_id ) { echo ' metabox-holder-disabled'; } ?>">
|
||||||
|
|
||||||
<form id="nav-menu-meta" action="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-menu-meta" method="post" enctype="multipart/form-data">
|
<form id="nav-menu-meta" action="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-menu-meta" method="post" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
|
<input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
|
||||||
|
|
|
@ -385,7 +385,7 @@ function wp_default_scripts( &$scripts ) {
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// Custom Navigation
|
// Custom Navigation
|
||||||
$scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100528b' );
|
$scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100529' );
|
||||||
$scripts->localize( 'nav-menu', 'navMenuL10n', array(
|
$scripts->localize( 'nav-menu', 'navMenuL10n', array(
|
||||||
'custom' => _x('Custom', 'menu nav item type'),
|
'custom' => _x('Custom', 'menu nav item type'),
|
||||||
'thickbox' => _x('Edit Menu Item', 'Thickbox Title'),
|
'thickbox' => _x('Edit Menu Item', 'Thickbox Title'),
|
||||||
|
@ -465,7 +465,7 @@ function wp_default_styles( &$styles ) {
|
||||||
$styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
|
$styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
|
||||||
$styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
|
$styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
|
||||||
$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' );
|
$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' );
|
||||||
$styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100527c' );
|
$styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100529' );
|
||||||
|
|
||||||
foreach ( $rtl_styles as $rtl_style ) {
|
foreach ( $rtl_styles as $rtl_style ) {
|
||||||
$styles->add_data( $rtl_style, 'rtl', true );
|
$styles->add_data( $rtl_style, 'rtl', true );
|
||||||
|
|
Loading…
Reference in New Issue