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:
parent
3baf443ae5
commit
b931f924a7
|
@ -2600,8 +2600,13 @@ function wp_ajax_save_user_color_scheme() {
|
||||||
wp_send_json_error();
|
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 );
|
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
|
||||||
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -119,6 +119,10 @@
|
||||||
action: 'save-user-color-scheme',
|
action: 'save-user-color-scheme',
|
||||||
color_scheme: $this.children( 'input[name="admin_color"]' ).val(),
|
color_scheme: $this.children( 'input[name="admin_color"]' ).val(),
|
||||||
nonce: $('#color-nonce').val()
|
nonce: $('#color-nonce').val()
|
||||||
|
}).done( function( response ) {
|
||||||
|
if ( response.success ) {
|
||||||
|
$( 'body' ).removeClass( response.data.previousScheme ).addClass( response.data.currentScheme );
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue