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:
markjaquith 2010-05-29 19:39:40 +00:00
parent d69536a671
commit 7aa4551ec7
6 changed files with 23 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@ -34,6 +34,10 @@ body {
padding:0 10px;
}
.metabox-holder-disabled {
opacity: 0.5;
}
#wpbody {
position: relative;
}

View File

@ -113,6 +113,10 @@ var wpNavMenu;
* @param jQuery metabox The metabox jQuery object.
*/
addSelectedToMenu : function(processMethod) {
if ( 0 == $('#menu-to-edit').length ) {
return false;
}
return this.each(function() {
var t = $(this), menuItems = {},
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(){
api.registerChange();
});
window.onbeforeunload = function(){
if ( api.menusChanged )
return navMenuL10n.saveAlert;
};
if ( 0 != $('#menu-to-edit').length ) {
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() {

File diff suppressed because one or more lines are too long

View File

@ -456,7 +456,7 @@ require_once( 'admin-header.php' );
endforeach;
?>
<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">
<input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />

View File

@ -385,7 +385,7 @@ function wp_default_scripts( &$scripts ) {
) );
// 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(
'custom' => _x('Custom', 'menu nav item type'),
'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( '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( '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 ) {
$styles->add_data( $rtl_style, 'rtl', true );