Update body class when switching between admin color schemes.

props valendesigns.
fixes #30488.

git-svn-id: https://develop.svn.wordpress.org/trunk@31400 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2015-02-10 02:22:49 +00:00
parent 3baf443ae5
commit b931f924a7
2 changed files with 10 additions and 1 deletions

View File

@ -2600,8 +2600,13 @@ function wp_ajax_save_user_color_scheme() {
wp_send_json_error();
}
$previous_color_scheme = get_user_meta( get_current_user_id(), 'admin_color', true );
update_user_meta( get_current_user_id(), 'admin_color', $color_scheme );
wp_send_json_success();
wp_send_json_success( array(
'previousScheme' => 'admin-color-' . $previous_color_scheme,
'currentScheme' => 'admin-color-' . $color_scheme
) );
}
/**

View File

@ -119,6 +119,10 @@
action: 'save-user-color-scheme',
color_scheme: $this.children( 'input[name="admin_color"]' ).val(),
nonce: $('#color-nonce').val()
}).done( function( response ) {
if ( response.success ) {
$( 'body' ).removeClass( response.data.previousScheme ).addClass( response.data.currentScheme );
}
});
}
});