Make WordPress Core

Changeset 37221


Ignore:
Timestamp:
04/16/2016 04:42:48 PM (9 years ago)
Author:
afercia
Message:

Plugin Install: show the upload form in place rather than sending users to the devoted upload plugin page.

Props Ipstenu, ericlewis, michaelarestad.

Fixes #35429.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/themes.css

    r37219 r37221  
    10571057    cursor: pointer;
    10581058}
    1059 .theme-install-php a.browse-themes,
    1060 .theme-install-php.show-upload-theme a.upload {
     1059
     1060.upload-view-toggle .browse,
     1061.upload-view-toggle.upload-tab .upload {
    10611062    display: none;
    10621063}
    1063 .theme-install-php.show-upload-theme a.browse-themes {
     1064
     1065.upload-view-toggle.upload-tab .browse {
    10641066    display: inline;
    10651067}
     1068
    10661069.upload-theme,
    10671070.upload-plugin {
     
    10771080    top: 10px;
    10781081}
    1079 body.show-upload-theme .upload-theme,
    1080 .upload-plugin {
    1081     display: block;
    1082 }
     1082
     1083.show-upload-view .upload-theme,
     1084.show-upload-view .upload-plugin,
     1085.upload-tab .upload-plugin {
     1086    display: block;
     1087}
     1088
    10831089.upload-theme .wp-upload-form,
    10841090.upload-plugin .wp-upload-form {
  • trunk/src/wp-admin/includes/admin-filters.php

    r35167 r37221  
    6565// Plugin Install hooks.
    6666add_action( 'install_plugins_featured',               'install_dashboard' );
    67 add_action( 'install_plugins_upload',                 'install_plugins_upload' );
    6867add_action( 'install_plugins_search',                 'display_plugins_table' );
    6968add_action( 'install_plugins_popular',                'display_plugins_table' );
  • trunk/src/wp-admin/includes/class-wp-upgrader-skins.php

    r35855 r37221  
    580580        } elseif ( $this->type == 'web' ) {
    581581            $install_actions['plugins_page'] = '<a href="' . self_admin_url( 'plugin-install.php' ) . '" target="_parent">' . __( 'Return to Plugin Installer' ) . '</a>';
     582        } elseif ( 'upload' == $this->type && 'plugins' == $from ) {
     583            $install_actions['plugins_page'] = '<a href="' . self_admin_url( 'plugin-install.php' ) . '">' . __( 'Return to Plugin Installer' ) . '</a>';
    582584        } else {
    583585            $install_actions['plugins_page'] = '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>';
  • trunk/src/wp-admin/includes/plugin-install.php

    r37156 r37221  
    211211function install_dashboard() {
    212212    ?>
    213     <p><?php printf( __( 'Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="%1$s">WordPress Plugin Directory</a> or upload a plugin in .zip format via <a href="%2$s">this page</a>.' ), 'https://wordpress.org/plugins/', self_admin_url( 'plugin-install.php?tab=upload' ) ); ?></p>
     213    <p><?php printf( __( 'Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="%1$s">WordPress Plugin Directory</a> or upload a plugin in .zip format by clicking the button at the top of this page.' ), 'https://wordpress.org/plugins/' ); ?></p>
    214214
    215215    <?php display_plugins_table(); ?>
  • trunk/src/wp-admin/js/plugin-install.js

    r36964 r37221  
    11/* global plugininstallL10n, tb_click, tb_remove */
    22
    3 /* Plugin Browser Thickbox related JS*/
     3/**
     4 * Functionality for the plugin install screens.
     5 */
    46var tb_position;
    57jQuery( document ).ready( function( $ ) {
     
    175177        $( '#section-' + tab ).show();
    176178    });
     179
     180    /*
     181     * When a user presses the "Upload Plugin" button, show the upload form in place
     182     * rather than sending them to the devoted upload plugin page.
     183     * @todo consider to abstract this in a generic, reusable, utility, see theme.js
     184     */
     185    var uploadViewToggle = $( '.upload-view-toggle' ),
     186        $body = $( document.body );
     187
     188    uploadViewToggle
     189        .attr({
     190            role: 'button',
     191            'aria-expanded': 'false'
     192        })
     193        .on( 'click', function( event ) {
     194            event.preventDefault();
     195            $body.toggleClass( 'show-upload-view' );
     196            uploadViewToggle.attr( 'aria-expanded', $body.hasClass( 'show-upload-view' ) );
     197        });
    177198});
  • trunk/src/wp-admin/js/theme.js

    r37145 r37221  
    16051605    searchContainer: $( '.wp-filter .search-form' ),
    16061606
     1607    /*
     1608     * When a user presses the "Upload Theme" button, show the upload form in place.
     1609     * @todo consider to abstract this in a generic, reusable, utility, see plugin-install.js
     1610     */
    16071611    uploader: function() {
    1608         $( 'a.upload' ).on( 'click', function( event ) {
    1609             event.preventDefault();
    1610             $( 'body' ).addClass( 'show-upload-theme' );
    1611             themes.router.navigate( themes.router.baseUrl( '?upload' ), { replace: true } );
    1612         });
    1613         $( 'a.browse-themes' ).on( 'click', function( event ) {
    1614             event.preventDefault();
    1615             $( 'body' ).removeClass( 'show-upload-theme' );
    1616             themes.router.navigate( themes.router.baseUrl( '' ), { replace: true } );
    1617         });
     1612        var uploadViewToggle = $( '.upload-view-toggle' ),
     1613            $body = $( document.body );
     1614
     1615        uploadViewToggle
     1616            .attr({
     1617                role: 'button',
     1618                'aria-expanded': 'false'
     1619            })
     1620            .on( 'click', function( event ) {
     1621                event.preventDefault();
     1622                $body.toggleClass( 'show-upload-view' );
     1623                uploadViewToggle.attr( 'aria-expanded', $body.hasClass( 'show-upload-view' ) );
     1624            });
    16181625    },
    16191626
  • trunk/src/wp-admin/plugin-install.php

    r34891 r37221  
    107107        if ( $tab === 'upload' ) {
    108108            $href = self_admin_url( 'plugin-install.php' );
    109             $text = _x( 'Browse', 'plugins' );
     109            $upload_tab_class = ' upload-tab';
    110110        } else {
    111111            $href = self_admin_url( 'plugin-install.php?tab=upload' );
    112             $text = __( 'Upload Plugin' );
     112            $upload_tab_class = '';
    113113        }
    114         echo ' <a href="' . $href . '" class="upload page-title-action">' . $text . '</a>';
     114
     115        printf( ' <a href="%s" class="upload-view-toggle page-title-action%s"><span class="upload">%s</span><span class="browse">%s</span></a>',
     116            $href,
     117            $upload_tab_class,
     118            __( 'Upload Plugin' ),
     119            __( 'Browse Plugins' )
     120        );
    115121    }
    116122    ?>
    117123</h1>
     124
     125<div class="upload-plugin-wrap<?php echo $upload_tab_class; ?>">
     126<?php
     127/*
     128 * Output the upload plugin form on every plugin install screen, so it can be
     129 * displayed via JavaScript rather then opening up the devoted upload plugin page.
     130 */
     131install_plugins_upload(); ?>
     132</div>
    118133
    119134<?php
  • trunk/src/wp-admin/plugins.php

    r36662 r37221  
    373373    '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' .
    374374    '<p>' . sprintf(
    375         /* translators: 1: Plugin Browser/Installer URL, 2: WordPress Plugin Directory URL 3: local plugin directory */
    376         __( 'You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your %3$s directory. Once a plugin has been installed, you can activate it here.' ),
    377         'plugin-install.php',
    378         'https://wordpress.org/plugins/',
    379         '<code>/wp-content/plugins</code>'
     375        /* translators: %s: WordPress Plugin Directory URL */
     376        __( 'If you would like to see more plugins to choose from, click on the &#8220;Add New&#8221; button and you will be able to browse or search for additional plugins from the <a href="%s" target="_blank">WordPress.org Plugin Directory</a>. Plugins in the WordPress.org Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they&#8217;re free!' ),
     377        'https://wordpress.org/plugins/'
    380378    ) . '</p>'
    381379) );
  • trunk/src/wp-admin/theme-install.php

    r37145 r37221  
    128128    $tabs = apply_filters( 'install_themes_tabs', array( 'upload' => __( 'Upload Theme' ) ) );
    129129    if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_themes' ) ) {
    130         echo ' <a href="#" class="upload page-title-action">' . __( 'Upload Theme' ) . '</a>';
    131         echo ' <a href="#" class="browse-themes page-title-action">' . _x( 'Browse', 'themes' ) . '</a>';
     130        echo ' <a href="#" class="upload-view-toggle page-title-action">' . __( 'Upload Theme' ) . '</a>';
    132131    }
    133132    ?></h1>
Note: See TracChangeset for help on using the changeset viewer.