Make WordPress Core


Ignore:
Timestamp:
11/13/2013 07:37:10 PM (12 years ago)
Author:
helen
Message:

Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.

Color scheme selection on your own profile page gives you a preview and autosaves the selection.

Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.

Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.

props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/user-profile.js

    r25637 r26137  
    7474            });
    7575        }
     76
     77        var $colorpicker = $( '#color-picker' ),
     78            $stylesheet = $( '#colors-css' ),
     79            user_id = $( 'input#user_id' ).val(),
     80            current_user_id = $( 'input[name="checkuser_id"]' ).val();
     81
     82        // dropdown toggle
     83        $colorpicker.on( 'click', '.dropdown-current', function() {
     84            $colorpicker.toggleClass( 'picker-expanded' );
     85        });
     86
     87        $colorpicker.on( 'click', '.color-option', function() {
     88
     89            var color_scheme = $( this ).children( 'input[name="admin_color"]' ).val();
     90
     91            // update selected
     92            $( this ).siblings( '.selected' ).removeClass( 'selected' )
     93            $( this ).addClass( 'selected' );
     94            $( this ).find( 'input' ).prop( 'checked', true );
     95
     96            // update current
     97            $colorpicker.find( '.dropdown-current label' ).html( $( this ).children( 'label' ).html() );
     98            $colorpicker.find( '.dropdown-current table' ).html( $( this ).children( 'table' ).html() );
     99            $colorpicker.toggleClass( 'picker-expanded' );
     100
     101            // preview/save color scheme
     102            if ( user_id == current_user_id ) {
     103
     104                // repaint icons
     105                $stylesheet.attr( 'href', $( this ).children( '.css_url' ).val() );
     106                svgPainter.setColors( $.parseJSON( $( this ).children( '.icon_colors' ).val() ) );
     107                svgPainter.paint();
     108
     109                // update user option
     110                $.post( ajaxurl, {
     111                    action: 'save-user-color-scheme',
     112                    color_scheme: color_scheme,
     113                    user_id: user_id
     114                });
     115
     116            }
     117
     118        });
     119
    76120    });
    77121
Note: See TracChangeset for help on using the changeset viewer.