Make WordPress Core

Ticket #28753: upload.diff

File upload.diff, 9.1 KB (added by paulwilde, 12 years ago)
  • src/wp-admin/css/forms.css

     
    751751        margin: -3px 3px;
    752752}
    753753
     754/*------------------------------------------------------------------------------
     755  21.0 - Upload File
     756------------------------------------------------------------------------------*/
     757
     758.wp-upload-container {
     759        -webkit-box-sizing: border-box;
     760        -moz-box-sizing: border-box;
     761        box-sizing: border-box;
     762        margin: 0px 0 0;
     763        padding: 0;
     764        width: 100%;
     765        overflow: hidden;
     766        position: relative;
     767        top: 10px;
     768}
     769
     770.wp-upload-container-toggle {
     771        display: none;
     772}
     773
     774.wp-upload-container .wp-upload-form {
     775        background: #fafafa;
     776        border: 1px solid #e5e5e5;
     777        padding: 30px;
     778        margin: 30px auto;
     779        max-width: 380px;
     780}
     781
     782.wp-upload-container .install-help {
     783        color: #999;
     784        font-size: 18px;
     785        font-style: normal;
     786        margin: 0;
     787        padding: 40px 0 0;
     788        text-align: center;
     789}
     790
     791body.show-upload-container .hide-on-upload,
     792body.show-upload-container .wp-upload-show {
     793        display: none;
     794}
     795
     796body.show-upload-container .wp-upload-container-toggle {
     797        display: block;
     798}
     799
     800.wp-upload-hide {
     801        display: none;
     802}
     803
     804body.show-upload-container .wp-upload-hide {
     805        display: inline;
     806}
     807
    754808/* =Media Queries
    755809-------------------------------------------------------------- */
    756810
     811@media only screen and (max-width: 1120px) {
     812        .wp-upload-container .wp-upload-form {
     813                margin: 20px 0;
     814                max-width: 100%;
     815        }
     816
     817        .wp-upload-container .install-help {
     818                font-size: 15px;
     819                padding: 20px 0 0;
     820                text-align: left;
     821        }
     822
     823}
     824
    757825@media screen and ( max-width: 782px ) {
    758826        /* Input Elements */
    759827        textarea {
  • src/wp-admin/css/themes.css

     
    10681068        display: none !important;
    10691069}
    10701070
    1071 .theme-install-php a.upload,
    1072 .theme-install-php a.browse-themes {
    1073         cursor: pointer;
    1074 }
    1075 .theme-install-php a.browse-themes,
    1076 .theme-install-php.show-upload-theme a.upload {
    1077         display: none;
    1078 }
    1079 .theme-install-php.show-upload-theme a.browse-themes {
    1080         display: inline;
    1081 }
    1082 .upload-theme {
    1083         -webkit-box-sizing: border-box;
    1084         -moz-box-sizing: border-box;
    1085         box-sizing: border-box;
    1086         display: none;
    1087         margin: 0;
    1088         padding: 0;
    1089         width: 100%;
    1090         overflow: hidden;
    1091         position: relative;
    1092         top: 10px;
    1093 }
    1094 body.show-upload-theme .upload-theme {
    1095         display: block;
    1096 }
    1097 .upload-theme .wp-upload-form {
    1098         background: #fafafa;
    1099         border: 1px solid #e5e5e5;
    1100         padding: 30px;
    1101         margin: 30px auto;
    1102         max-width: 380px;
    1103 }
    1104 .upload-theme .install-help {
    1105         color: #999;
    1106         font-size: 18px;
    1107         font-style: normal;
    1108         margin: 0;
    1109         padding: 40px 0 0;
    1110         text-align: center;
    1111 }
    1112 body.show-upload-theme .upload-theme + .wp-filter,
    1113 body.show-upload-theme .upload-theme + .wp-filter + .theme-browser {
    1114         display: none;
    1115 }
    1116 
    11171071p.no-themes {
    11181072        color: #999;
    11191073        font-size: 18px;
     
    11261080body.no-results p.no-themes {
    11271081        display: block;
    11281082}
    1129 body.show-upload-theme p.no-themes {
     1083body.show-upload-container p.no-themes {
    11301084        display: none !important;
    11311085}
    11321086
     
    11341088        display: none !important;
    11351089}
    11361090
    1137 @media only screen and (max-width: 1120px) {
    1138         .upload-theme .wp-upload-form {
    1139                 margin: 20px 0;
    1140                 max-width: 100%;
    1141         }
    1142         .upload-theme .install-help {
    1143                 font-size: 15px;
    1144                 padding: 20px 0 0;
    1145                 text-align: left;
    1146         }
    1147 }
    1148 
    11491091.rating {
    11501092        margin: 30px 0;
    11511093}
  • src/wp-admin/includes/plugin-install.php

     
    196196 */
    197197function install_plugins_upload( $page = 1 ) {
    198198?>
    199         <h4><?php _e('Install a plugin in .zip format'); ?></h4>
    200         <p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.'); ?></p>
    201         <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-plugin'); ?>">
    202                 <?php wp_nonce_field( 'plugin-upload'); ?>
    203                 <label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>
    204                 <input type="file" id="pluginzip" name="pluginzip" />
    205                 <?php submit_button( __( 'Install Now' ), 'button', 'install-plugin-submit', false ); ?>
    206         </form>
     199        <div class="wp-upload-container">
     200                <p class="install-help"><?php _e( 'If you have a plugin in a .zip format, you may install it by uploading it here.' ); ?></p>
     201                <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url( 'update.php?action=upload-plugin' ); ?>">
     202                        <?php wp_nonce_field( 'plugin-upload' ); ?>
     203                        <label class="screen-reader-text" for="pluginzip"><?php _e( 'Plugin zip file' ); ?></label>
     204                        <input type="file" id="pluginzip" name="pluginzip" />
     205                        <?php submit_button( __( 'Install Now' ), 'button', 'install-plugin-submit', false ); ?>
     206                </form>
     207        </div>
    207208<?php
    208209}
    209210add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
  • src/wp-admin/includes/theme-install.php

     
    136136
    137137function install_themes_upload() {
    138138?>
    139 <p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.'); ?></p>
    140 <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-theme'); ?>">
    141         <?php wp_nonce_field( 'theme-upload'); ?>
    142         <input type="file" name="themezip" />
    143         <?php submit_button( __( 'Install Now' ), 'button', 'install-theme-submit', false ); ?>
    144 </form>
    145         <?php
     139        <div class="wp-upload-container wp-upload-container-toggle">
     140                <p class="install-help"><?php _e( 'If you have a theme in a .zip format, you may install it by uploading it here.' ); ?></p>
     141                <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url( 'update.php?action=upload-theme' ); ?>">
     142                        <?php wp_nonce_field( 'theme-upload' ); ?>
     143                        <input type="file" name="themezip" />
     144                        <?php submit_button( __( 'Install Now' ), 'button', 'install-theme-submit', false ); ?>
     145                </form>
     146        </div>
     147<?php
    146148}
    147149// add_action('install_themes_upload', 'install_themes_upload', 10, 0);
    148150
  • src/wp-admin/js/theme.js

     
    14971497        searchContainer: $( '.wp-filter' ),
    14981498
    14991499        uploader: function() {
    1500                 $( 'a.upload' ).on( 'click', function( event ) {
     1500                $( '.wp-upload-show' ).on( 'click', function( event ) {
    15011501                        event.preventDefault();
    1502                         $( 'body' ).addClass( 'show-upload-theme' );
     1502                        $( 'body' ).addClass( 'show-upload-container' );
    15031503                        themes.router.navigate( themes.router.baseUrl( '?upload' ), { replace: true } );
    15041504                });
    1505                 $( 'a.browse-themes' ).on( 'click', function( event ) {
     1505                $( '.wp-upload-hide' ).on( 'click', function( event ) {
    15061506                        event.preventDefault();
    1507                         $( 'body' ).removeClass( 'show-upload-theme' );
     1507                        $( 'body' ).removeClass( 'show-upload-container' );
    15081508                        themes.router.navigate( themes.router.baseUrl( '' ), { replace: true } );
    15091509                });
    15101510        },
     
    16421642
    16431643                // Support the `upload` route by going straight to upload section
    16441644                themes.router.on( 'route:upload', function() {
    1645                         $( 'a.upload' ).trigger( 'click' );
     1645                        $( '.wp-upload-show' ).trigger( 'click' );
    16461646                });
    16471647
    16481648                // The `search` route event. The router populates the input field.
  • src/wp-admin/theme-install.php

     
    125125                 */
    126126                $tabs = apply_filters( 'install_themes_tabs', $tabs );
    127127                foreach ( $tabs as $tab_slug => $tab_name ) {
    128                         echo '<a href="#" class="' . esc_attr( $tab_slug ) . ' add-new-h2">' . $tab_name . '</a>';
     128                        $visibility = $tab_slug == 'upload' ? ' wp-upload-show' : ' wp-upload-hide';
     129                       
     130                        echo '<a href="#" class="' . esc_attr( $tab_slug ) . $visibility . ' add-new-h2">' . $tab_name . '</a>';
    129131                }
    130132                ?>
    131133        </h2>
    132134
    133         <div class="upload-theme">
    134135        <?php install_themes_upload(); ?>
    135         </div>
    136136
    137         <div class="wp-filter">
     137        <div class="wp-filter hide-on-upload">
    138138                <div class="wp-filter-count">
    139139                        <span class="count theme-count"></span>
    140140                </div>
     
    179179                        </div>
    180180                </div>
    181181        </div>
    182         <div class="theme-browser wp-filter-content"></div>
    183         <div class="theme-install-overlay wp-full-overlay expanded"></div>
    184 
    185         <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
    186         <span class="spinner"></span>
    187 
     182       
     183        <div class="hide-on-upload">
     184                <div class="theme-browser wp-filter-content"></div>
     185                <div class="theme-install-overlay wp-full-overlay expanded"></div>
     186       
     187                <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
     188                <span class="spinner"></span>
     189        </div>
     190       
    188191        <br class="clear" />
    189192<?php
    190193/**