From b9893b491c51e726a35106dcd94ae879dfbc1947 Mon Sep 17 00:00:00 2001 From: Matt Thomas Date: Fri, 6 Dec 2013 21:25:31 +0000 Subject: [PATCH] Adding autosave for color schemes and removing RTL handling. See #26387, props ryelle. git-svn-id: https://develop.svn.wordpress.org/trunk@26746 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/about.php | 4 +++- src/wp-admin/js/about.js | 16 ++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/wp-admin/about.php b/src/wp-admin/about.php index 955ded133c..0f9b1dc19a 100644 --- a/src/wp-admin/about.php +++ b/src/wp-admin/about.php @@ -81,15 +81,17 @@ include( ABSPATH . 'wp-admin/admin-header.php' );

+ 1 && has_action('admin_color_scheme_picker') ) :?> -

visit your profile settings.' ), get_edit_profile_url( get_current_user_id() ) ); ?>

+

visit your profile settings.' ), get_edit_profile_url( $user_id ) ); ?>

diff --git a/src/wp-admin/js/about.js b/src/wp-admin/js/about.js index b7290cc20d..e96b72ce2c 100644 --- a/src/wp-admin/js/about.js +++ b/src/wp-admin/js/about.js @@ -1,4 +1,4 @@ -/* global isRtl */ +/* global ajaxurl */ (function($){ $(document).ready( function() { @@ -10,9 +10,6 @@ $colorpicker = $( '#color-picker' ); $stylesheet = $( '#colors-css' ); - if ( isRtl ){ - $stylesheet = $( '#colors-rtl-css' ); - } $colorpicker.on( 'click.colorpicker', '.color-option', function() { var colors, css_url, @@ -28,10 +25,6 @@ // Set color scheme // Load the colors stylesheet css_url = $this.children( '.css_url' ).val(); - if ( isRtl ){ - css_url = css_url.replace('.min', '-rtl.min'); - } - $stylesheet.attr( 'href', css_url ); // repaint icons @@ -45,6 +38,13 @@ wp.svgPainter.paint(); } } + + // update user option + $.post( ajaxurl, { + action: 'save-user-color-scheme', + color_scheme: $this.children( 'input[name="admin_color"]' ).val(), + nonce: $('#_wpnonce').val() + }); }); });