Make WordPress Core

Changeset 31400


Ignore:
Timestamp:
02/10/2015 02:22:49 AM (10 years ago)
Author:
SergeyBiryukov
Message:

Update body class when switching between admin color schemes.

props valendesigns.
fixes #30488.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r31345 r31400  
    26012601    }
    26022602
     2603    $previous_color_scheme = get_user_meta( get_current_user_id(), 'admin_color', true );
    26032604    update_user_meta( get_current_user_id(), 'admin_color', $color_scheme );
    2604     wp_send_json_success();
     2605
     2606    wp_send_json_success( array(
     2607        'previousScheme' => 'admin-color-' . $previous_color_scheme,
     2608        'currentScheme'  => 'admin-color-' . $color_scheme
     2609    ) );
    26052610}
    26062611
  • trunk/src/wp-admin/js/user-profile.js

    r30888 r31400  
    120120                    color_scheme: $this.children( 'input[name="admin_color"]' ).val(),
    121121                    nonce:        $('#color-nonce').val()
     122                }).done( function( response ) {
     123                    if ( response.success ) {
     124                        $( 'body' ).removeClass( response.data.previousScheme ).addClass( response.data.currentScheme );
     125                    }
    122126                });
    123127            }
Note: See TracChangeset for help on using the changeset viewer.