Fix the ajax loading/processing spinner for nav menu meta boxes. see #13134.

git-svn-id: http://svn.automattic.com/wordpress/trunk@14293 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-04-29 07:10:54 +00:00
parent 7677e2e874
commit 7bb32597b7
6 changed files with 16 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -148,14 +148,12 @@
float: right; float: right;
} }
form.processing .add-to-menu { .postbox img.waiting {
background: url("../images/wpspin_light.gif") no-repeat top center; display: none
display:block; vertical-align: middle;
height:20px; }
overflow:hidden; form.processing .postbox img.waiting {
text-align:left; display: inline;
text-indent:-999em;
width:20px;
} }
.button-controls { margin: 10px 0; } .button-controls { margin: 10px 0; }

View File

@ -434,6 +434,7 @@ function wp_nav_menu_item_link_meta_box() {
<p class="button-controls"> <p class="button-controls">
<span class="add-to-menu"> <span class="add-to-menu">
<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
<input type="submit" class="button-secondary" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" /> <input type="submit" class="button-secondary" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" />
</span> </span>
</p> </p>
@ -622,6 +623,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
</span> </span>
<span class="add-to-menu"> <span class="add-to-menu">
<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
<input type="submit" class="button-secondary" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-post-type-menu-item" /> <input type="submit" class="button-secondary" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-post-type-menu-item" />
</span> </span>
</p> </p>
@ -789,6 +791,7 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
</span> </span>
<span class="add-to-menu"> <span class="add-to-menu">
<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
<input type="submit" class="button-secondary" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-taxonomy-menu-item" /> <input type="submit" class="button-secondary" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-taxonomy-menu-item" />
</span> </span>
</p> </p>

View File

@ -240,6 +240,9 @@ var WPNavMenuHandler = function () {
$(formEL).bind('submit', function(e) { $(formEL).bind('submit', function(e) {
return that.eventSubmitMetaForm.call(that, this, e); return that.eventSubmitMetaForm.call(that, this, e);
}); });
$(formEL).find('input:submit').click(function() {
$(this).siblings('img.waiting').show();
});
}, },
attachTabsPanelListeners : function() { attachTabsPanelListeners : function() {
@ -484,9 +487,7 @@ var WPNavMenuHandler = function () {
processMethod = function(){}, processMethod = function(){},
re = new RegExp('menu-item\\[(\[^\\]\]*)'); re = new RegExp('menu-item\\[(\[^\\]\]*)');
thisForm.className = thisForm.className + ' processing',
that = this; that = this;
params['action'] = ''; params['action'] = '';
while ( i-- ) { while ( i-- ) {
@ -533,7 +534,7 @@ var WPNavMenuHandler = function () {
$.post( ajaxurl, params, function(menuMarkup) { $.post( ajaxurl, params, function(menuMarkup) {
processMethod.call(that, menuMarkup, params); processMethod.call(that, menuMarkup, params);
thisForm.className = thisForm.className.replace(/processing/g, ''); $(thisForm).find('img.waiting').hide();
}); });
return false; return false;

File diff suppressed because one or more lines are too long

View File

@ -143,7 +143,7 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
$output .= $indent . '<li>'; $output .= $indent . '<li>';
$output .= '<label class="menu-item-title">'; $output .= '<label class="menu-item-title">';
$output .= '<input type="checkbox" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" />'; $output .= '<input type="checkbox" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> ';
$output .= $item->title .'</label>'; $output .= $item->title .'</label>';
// Menu item hidden fields // Menu item hidden fields