Make WordPress Core

Ticket #41316: 41316.3.diff

File 41316.3.diff, 9.1 KB (added by pento, 6 years ago)
  • src/wp-admin/css/common.css

     
    764764
    765765/* @todo can we combine these into a class or use an existing dashicon one? */
    766766.welcome-panel .welcome-panel-close:before,
     767.try-gutenberg-panel .try-gutenberg-panel-close:before,
    767768.tagchecklist .ntdelbutton .remove-tag-icon:before,
    768769#bulk-titles div a:before,
    769770.notice-dismiss:before {
  • src/wp-admin/css/dashboard.css

     
    9898}
    9999
    100100/* Welcome Panel */
    101 .welcome-panel {
     101.welcome-panel,
     102.try-gutenberg-panel {
    102103        position: relative;
    103104        overflow: auto;
    104105        margin: 16px 0;
     
    110111        line-height: 2.1em;
    111112}
    112113
    113 .welcome-panel h2 {
     114.welcome-panel h2,
     115.try-gutenberg-panel h2 {
    114116        margin: 0;
    115117        font-size: 21px;
    116118        font-weight: 400;
    117119        line-height: 1.2;
    118120}
    119121
    120 .welcome-panel h3 {
     122.welcome-panel h3,
     123.try-gutenberg-panel h3 {
    121124        margin: 1.33em 0 0;
    122125        font-size: 16px;
    123126}
     
    126129        font-size: 14px;
    127130}
    128131
    129 .welcome-panel p {
     132.welcome-panel p,
     133.try-gutenberg-panel p {
    130134        color: #72777c;
    131135}
    132136
    133 .welcome-panel a {
     137.welcome-panel a,
     138.try-gutenberg-panel a {
    134139        text-decoration: none;
    135140}
    136141
    137 .welcome-panel .about-description {
     142.welcome-panel .about-description,
     143.try-gutenberg-panel .about-description {
    138144        font-size: 16px;
    139145        margin: 0;
    140146}
    141147
    142 .welcome-panel .welcome-panel-close {
     148.welcome-panel .welcome-panel-close,
     149.try-gutenberg-panel .try-gutenberg-panel-close {
    143150        position: absolute;
    144151        top: 10px;
    145152        right: 10px;
     
    149156        text-decoration: none;
    150157}
    151158
    152 .welcome-panel .welcome-panel-close:before {
     159.welcome-panel .welcome-panel-close:before,
     160.try-gutenberg-panel .try-gutenberg-panel-close:before {
    153161        position: absolute;
    154162        top: 8px;
    155163        left: 0;
     
    164172        white-space: normal;
    165173}
    166174
    167 .welcome-panel-content {
    168         margin-left: 13px;
     175.welcome-panel-content,
     176.try-gutenberg-panel-content {
     177        margin: 0 13px;
    169178        max-width: 1500px;
    170179}
    171180
     181.try-gutenberg-panel img {
     182        width: 400px;
     183        float: left;
     184        padding: 0 20px 20px 0;
     185}
     186
     187.try-gutenberg-panel .install-now.updating-message:before,
     188.try-gutenberg-panel .install-now.updated-message:before {
     189        margin-top: 11px;
     190}
     191
    172192.welcome-panel .welcome-panel-column-container {
    173193        clear: both;
    174194        position: relative;
     
    12241244                margin: 0.4em 0 0;
    12251245        }
    12261246
     1247        .try-gutenberg-panel img {
     1248                padding-top: 15px;
     1249                width: 100%;
     1250        }
     1251
    12271252}
    12281253
    12291254@media screen and ( max-width: 782px ) {
     
    12661291/* Smartphone */
    12671292@media screen and (max-width: 600px) {
    12681293        /* Keep the close icon from overlapping the Welcome text. */
    1269         .welcome-panel .welcome-panel-close {
     1294        .welcome-panel .welcome-panel-close,
     1295        .try-gutenberg-panel .try-gutenberg-panel-close {
    12701296                overflow: hidden;
    12711297                text-indent: 40px;
    12721298                white-space: nowrap;
     
    12781304        }
    12791305
    12801306        /* Make the close icon larger for tappability. */
    1281         .welcome-panel .welcome-panel-close:before {
     1307        .welcome-panel .welcome-panel-close:before,
     1308        .try-gutenberg-panel .try-gutenberg-panel-close:before {
    12821309                font-size: 20px;
    12831310                top: 5px;
    12841311                left: -35px;
  • src/wp-admin/includes/dashboard.php

     
    16191619        </div>
    16201620        <?php
    16211621}
     1622
     1623/**
     1624 * Displays a Try Gutenberg Panel, to introduce people to Gutenberg
     1625 *
     1626 * @since 4.9.0
     1627 */
     1628function wp_try_gutenberg_panel() {
     1629        $plugins = get_plugins();
     1630        $action = $url = $classes = '';
     1631
     1632        if ( current_user_can( 'install_plugins' ) && empty( $plugins['gutenberg/gutenberg.php'] ) ) {
     1633                $action = __( 'Download today' );
     1634                $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=gutenberg' ), 'install-plugin_gutenberg' );
     1635                $classes = ' install-now';
     1636        } else if ( current_user_can( 'install_plugins' ) && is_plugin_inactive( 'gutenberg/gutenberg.php' ) ) {
     1637                $action = __( 'Activate today' );
     1638                $url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=gutenberg/gutenberg.php' ), 'activate-plugin_gutenberg/gutenberg.php' );
     1639        } else if ( current_user_can( 'edit_posts' ) ) {
     1640                $action = __( 'Try today' );
     1641                $url = admin_url( 'admin.php?page=gutenberg' );
     1642        }
     1643
     1644        ?>
     1645        <div id="plugin-filter" class="try-gutenberg-panel-content plugin-card-gutenberg">
     1646                <img src="https://wordpress.org/gutenberg/files/2017/08/colimage-Gutenberg-1.gif?<?php echo date( 'Ymd' ); ?>" alt="" />
     1647                <h2><?php _e( 'Try the new editing experience' ); ?></h2>
     1648                <p class="about-description"><?php _e( 'Discover the project codenamed Gutenberg today' ); ?></p>
     1649                <?php if ( $action ) { ?>
     1650                        <p><a class="button button-primary button-hero<?php echo $classes; ?>" data-slug="gutenberg" href="<?php echo esc_url( $url ); ?>"><?php echo $action; ?></a></p>
     1651                <?php } ?>
     1652                <h3><?php _e( 'Want to get involved?' ); ?></h3>
     1653                <p><?php printf( __( 'Learn more about this project <a href="%s">right here</a>.' ), 'https://wordpress.org/gutenberg/' ); ?></p>
     1654                <p><?php printf( __( 'Help <a href="%1$s">with testing</a>, or contribute on the <a href="%2$s">GitHub repository</a>.' ), '', 'https://github.com/WordPress/gutenberg/' ); ?></p>
     1655        </div>
     1656        <?php
     1657}
  • src/wp-admin/index.php

     
    103103<div class="wrap">
    104104        <h1><?php echo esc_html( $title ); ?></h1>
    105105
     106        <?php if ( has_action( 'try_gutenberg_panel' ) ) :
     107        $classes = 'try-gutenberg-panel';
     108
     109        $option = get_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', true );
     110        echo $option;
     111        // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
     112        $hide = 0 === $option || ( 2 === $option && wp_get_current_user()->user_email !== get_option( 'admin_email' ) );
     113        if ( $hide )
     114                $classes .= ' hidden'; ?>
     115
     116        <div id="gutenpanel" class="<?php echo esc_attr( $classes ); ?>">
     117                <?php wp_nonce_field( 'try-gutenberg-panel-nonce', 'trygutenbergpanelnonce', false ); ?>
     118                <a class="try-gutenberg-panel-close" href="<?php echo esc_url( admin_url( '?try_gutenberg=0' ) ); ?>" aria-label="<?php esc_attr_e( 'Dismiss the Try Gutenberg panel' ); ?>"><?php _e( 'Dismiss' ); ?></a>
     119                <?php
     120                /**
     121                 * Add content to the Try Gutenberg panel on the admin dashboard.
     122                 *
     123                 * To remove the Try Gutenberg panel, use remove_action():
     124                 *
     125                 *     remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );
     126                 *
     127                 * @since 4.9.0
     128                 */
     129                do_action( 'try_gutenberg_panel' );
     130                ?>
     131        </div>
     132<?php endif; ?>
    106133<?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
    107134        $classes = 'welcome-panel';
    108135
  • src/wp-admin/js/updates.js

     
    585585
    586586                $message
    587587                        .removeClass( 'updating-message' )
    588                         .addClass( 'updated-message installed button-disabled' )
     588                        .addClass( 'updated-message installed' )
    589589                        .attr( 'aria-label', wp.updates.l10n.pluginInstalledLabel.replace( '%s', response.pluginName ) )
    590590                        .text( wp.updates.l10n.pluginInstalled );
    591591
     592                if ( $message.hasClass( 'button-primary' ) ) {
     593                        $message.addClass( 'button-primary-disabled' );
     594                } else if ( $message.hasClass( 'button-secondary' ) ) {
     595                        $message.addClass( 'button-secondary-disabled' );
     596                } else {
     597                        $message.addClass( 'button-disabled' );
     598                }
     599
    592600                wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' );
    593601
    594602                $document.trigger( 'wp-plugin-install-success', response );
     
    597605                        setTimeout( function() {
    598606
    599607                                // Transform the 'Install' button into an 'Activate' button.
    600                                 $message.removeClass( 'install-now installed button-disabled updated-message' ).addClass( 'activate-now button-primary' )
     608                                $message.removeClass( 'install-now installed button-primary-disabled button-secondary-disabled button-disabled updated-message' )
     609                                        .addClass( 'activate-now button-primary' )
    601610                                        .attr( 'href', response.activateUrl )
    602611                                        .attr( 'aria-label', wp.updates.l10n.activatePluginLabel.replace( '%s', response.pluginName ) )
    603612                                        .text( wp.updates.l10n.activatePlugin );
  • src/wp-includes/default-filters.php

     
    322322add_action( 'admin_init',                 'send_frame_options_header',               10, 0 );
    323323add_action( 'importer_scheduled_cleanup', 'wp_delete_attachment'                           );
    324324add_action( 'upgrader_scheduled_cleanup', 'wp_delete_attachment'                           );
     325add_action( 'try_gutenberg_panel',        'wp_try_gutenberg_panel'                         );
    325326add_action( 'welcome_panel',              'wp_welcome_panel'                               );
    326327
    327328// Navigation menu actions