Make WordPress Core

Ticket #28784: 28784.diff

File 28784.diff, 3.5 KB (added by celloexpressions, 11 years ago)

Fresh approach: simple header with a toggle between the preview and the Customizer controls, no animations or swiping.

  • src/wp-admin/css/customize-controls.css

     
    235235.customize-controls-close:focus,
    236236.customize-controls-close:hover,
    237237.control-panel-back:focus,
    238 .control-panel-back:hover {
     238.control-panel-back:hover,
     239.customize-controls-preview-toggle:focus,
     240.customize-controls-preview-toggle:hover {
    239241        background: #ddd;
    240242        border-color: #ccc;
    241243        color: #000;
     
    848850        line-height: 1.5;
    849851        margin: 25px 0 20px;
    850852}
     853
     854/* Responsive */
     855.customize-controls-preview-toggle {
     856        display: none;
     857}
     858
     859@media screen and (max-width:640px) {
     860        #customize-controls {
     861                width: 100%;
     862        }
     863
     864        .wp-full-overlay.expanded {
     865                margin-left: 0;
     866        }
     867
     868        .wp-full-overlay-sidebar .wp-full-overlay-sidebar-content {
     869                bottom: 0;
     870        }
     871
     872        .customize-controls-preview-toggle {
     873                display: block;
     874                position: absolute;
     875                top: 0;
     876                left: 48px;
     877                line-height: 45px;
     878                font-size: 14px;
     879                padding: 0 12px 0 12px;
     880                margin: 0;
     881                height: 45px;
     882                background: #eee;
     883                border-right: 1px solid #ddd;
     884                color: #444;
     885                cursor: pointer;
     886                -webkit-transition: color .1s ease-in-out, background .1s ease-in-out;
     887                transition: color .1s ease-in-out, background .1s ease-in-out;
     888        }
     889
     890        #customize-footer-actions,
     891        #customize-preview,
     892        .customize-controls-preview-toggle .controls,
     893        .preview-only .wp-full-overlay-sidebar-content,
     894        .preview-only .customize-controls-preview-toggle .preview {
     895                display: none;
     896        }
     897
     898        .customize-controls-preview-toggle .preview:before,
     899        .customize-controls-preview-toggle .controls:before {
     900                font: normal 20px/1 dashicons;
     901                content: "\f177";
     902                position: relative;
     903                top: 4px;
     904                margin-right: 6px;
     905        }
     906
     907        .customize-controls-preview-toggle .controls:before {
     908                content: "\f100";
     909        }
     910
     911        .preview-only #customize-controls {
     912                height: 45px;
     913        }
     914
     915        .preview-only #customize-preview,
     916        .preview-only .customize-controls-preview-toggle .controls {
     917                display: block;
     918        }
     919
     920        #customize-preview {
     921                top: 45px;
     922                bottom: 0;
     923                height: auto;
     924        }
     925}
  • src/wp-admin/customize.php

     
    126126                                submit_button( $save_text, 'primary save', 'save', false );
    127127                        ?>
    128128                        <span class="spinner"></span>
     129                        <a class="customize-controls-preview-toggle" href="#">
     130                                <span class="controls"><?php _e( 'Customize' ); ?></span>
     131                                <span class="preview"><?php _e( 'Preview' ); ?></span>
     132                        </a>
    129133                        <a class="customize-controls-close" href="<?php echo esc_url( $return ); ?>">
    130134                                <span class="screen-reader-text"><?php _e( 'Cancel' ); ?></span>
    131135                        </a>
  • src/wp-admin/js/customize-controls.js

     
    22392239                        event.preventDefault();
    22402240                });
    22412241
     2242                $( '.customize-controls-preview-toggle' ).on( 'click keydown', function( event ) {
     2243                        if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
     2244                                return;
     2245                        }
     2246
     2247                        overlay.toggleClass( 'preview-only' );
     2248                        event.preventDefault();
     2249                });
     2250
    22422251                // Bind site title display to the corresponding field.
    22432252                if ( title.length ) {
    22442253                        $( '#customize-control-blogname input' ).on( 'input', function() {