Make WordPress Core

Ticket #41316: 41316.diff

File 41316.diff, 9.0 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 {
     175.welcome-panel-content,
     176.try-gutenberg-panel-content {
    168177        margin-left: 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;
  • src/wp-admin/css/list-tables.css

     
    12961296        white-space:nowrap;
    12971297}
    12981298
     1299#wpbody-content .plugins .plugin-title.has-icon img {
     1300        float: left;
     1301        margin: 0 9px 0 0;
     1302        width: 64px;
     1303        height: 64px;
     1304}
     1305
     1306#wpbody-content .plugins .plugin-title.has-icon strong {
     1307        margin-right: 64px;
     1308}
     1309
    12991310.updates-table-screenshot {
    13001311        float:left;
    13011312        padding: 0 10px 5px 0;
  • src/wp-admin/includes/dashboard.php

     
    15601560 *
    15611561 * @since 3.3.0
    15621562 */
    1563 function wp_welcome_panel() {
     1563 function wp_welcome_panel() {
    15641564        ?>
    15651565        <div class="welcome-panel-content">
    15661566        <h2><?php _e( 'Welcome to WordPress!' ); ?></h2>
     
    16181618        </div>
    16191619        <?php
    16201620}
     1621
     1622/**
     1623 * Displays a Try Gutenberg Panel, to introduce people to Gutenberg
     1624 *
     1625 * @since 4.9.0
     1626 */
     1627function wp_try_gutenberg_panel() {
     1628        $plugins = get_plugins();
     1629        $action = $url = $classes = '';
     1630
     1631        if ( current_user_can( 'install_plugins' ) && empty( $plugins['gutenberg/gutenberg.php'] ) ) {
     1632                $action = __( 'Download Gutenberg today' );
     1633                $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=gutenberg' ), 'install-plugin_gutenberg' );
     1634                $classes = ' install-now';
     1635        } else if ( current_user_can( 'install_plugins' ) && is_plugin_inactive( 'gutenberg/gutenberg.php' ) ) {
     1636                $action = __( 'Activate Gutenberg today' );
     1637                $url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=gutenberg/gutenberg.php' ), 'activate-plugin_gutenberg/gutenberg.php' );
     1638        } else if ( current_user_can( 'edit_posts' ) ) {
     1639                $action = __( 'Try Gutenberg today' );
     1640                $url = admin_url( 'admin.php?page=gutenberg' );
     1641        }
     1642
     1643        ?>
     1644        <div id="plugin-filter" class="try-gutenberg-panel-content plugin-card-gutenberg">
     1645                <img src="https://wordpress.org/gutenberg/files/2017/08/colimage-Gutenberg-1.gif" />
     1646                <h2><?php _e( 'Try Gutenberg' ); ?></h2>
     1647                <p class="about-description"><?php _e( 'The new editing experience for WordPress' ); ?></p>
     1648                <?php if ( $action ) { ?>
     1649                        <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>
     1650                <?php } ?>
     1651                <h3><?php _e( 'Want to get involved?' ); ?></h3>
     1652                <p><?php printf( __( 'Learn more about Gutenberg <a href="%s">right here</a>.' ), 'https://wordpress.org/gutenberg/' ); ?></p>
     1653                <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>
     1654        </div>
     1655        <?php
     1656}
  • src/wp-admin/index.php

     
    105105<div class="wrap">
    106106        <h1><?php echo esc_html( $title ); ?></h1>
    107107
     108        <?php if ( has_action( 'try_gutenberg_panel' ) ) :
     109        $classes = 'try-gutenberg-panel';
     110
     111        $option = get_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', true );
     112        echo $option;
     113        // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
     114        $hide = 0 === $option || ( 2 === $option && wp_get_current_user()->user_email !== get_option( 'admin_email' ) );
     115        if ( $hide )
     116                $classes .= ' hidden'; ?>
     117
     118        <div id="gutenpanel" class="<?php echo esc_attr( $classes ); ?>">
     119                <?php wp_nonce_field( 'try-gutenberg-panel-nonce', 'trygutenbergpanelnonce', false ); ?>
     120                <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>
     121                <?php
     122                /**
     123                 * Add content to the Try Gutenberg panel on the admin dashboard.
     124                 *
     125                 * To remove the Try Gutenberg panel, use remove_action():
     126                 *
     127                 *     remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );
     128                 *
     129                 * @since 4.9.0
     130                 */
     131                do_action( 'try_gutenberg_panel' );
     132                ?>
     133        </div>
     134<?php endif; ?>
    108135<?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
    109136        $classes = 'welcome-panel';
    110137
  • 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