Make WordPress Core

Changeset 44106


Ignore:
Timestamp:
12/13/2018 09:06:20 AM (6 years ago)
Author:
pento
Message:

Dashboard: Remove the Try Gutenberg callout.

Merge of [43807] from the 5.0 branch.

Props mukesh27.
Fixes #45063.

Location:
branches/4.9
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/admin-ajax.php

    r43537 r44106  
    6868    'wp-privacy-export-personal-data',
    6969    'wp-privacy-erase-personal-data',
    70     'update-try-gutenberg-panel',
    7170);
    7271
  • branches/4.9/src/wp-admin/css/common.css

    r43502 r44106  
    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,
    768767.tagchecklist .ntdelbutton .remove-tag-icon:before,
    769768#bulk-titles div a:before,
  • branches/4.9/src/wp-admin/css/dashboard.css

    r43674 r44106  
    9999
    100100/* Welcome Panel */
    101 .welcome-panel,
    102 .try-gutenberg-panel {
     101.welcome-panel {
    103102    position: relative;
    104103    overflow: auto;
     
    112111}
    113112
    114 .welcome-panel h2,
    115 .try-gutenberg-panel h2 {
     113.welcome-panel h2 {
    116114    margin: 0;
    117115    font-size: 21px;
     
    125123}
    126124
    127 .try-gutenberg-panel h3 {
    128     margin: 17px 0 0;
     125.welcome-panel li {
     126    font-size: 14px;
     127}
     128
     129.welcome-panel p {
     130    color: #72777c;
     131}
     132
     133.welcome-panel a {
     134    text-decoration: none;
     135}
     136
     137.welcome-panel .about-description {
    129138    font-size: 16px;
    130     line-height: 1.4;
    131 }
    132 
    133 .welcome-panel li,
    134 .try-gutenberg-panel li {
    135     font-size: 14px;
    136 }
    137 
    138 .welcome-panel p,
    139 .try-gutenberg-panel p {
    140     color: #72777c;
    141 }
    142 
    143 .welcome-panel a,
    144 .try-gutenberg-action a {
    145     text-decoration: none;
    146 }
    147 
    148 .welcome-panel .about-description,
    149 .try-gutenberg-panel .about-description {
    150     font-size: 16px;
    151     margin: 0;
    152 }
    153 
    154 .try-gutenberg-panel-content hr {
    155     margin: 20px -23px 0 -23px;
    156     border-top: 1px solid #f3f4f5;
    157     border-bottom: none;
    158 }
    159 
    160 .welcome-panel .welcome-panel-close,
    161 .try-gutenberg-panel .try-gutenberg-panel-close {
     139    margin: 0;
     140}
     141
     142.welcome-panel .welcome-panel-close {
    162143    position: absolute;
    163144    z-index: 10;
     
    170151}
    171152
    172 .welcome-panel .welcome-panel-close:before,
    173 .try-gutenberg-panel .try-gutenberg-panel-close:before {
     153.welcome-panel .welcome-panel-close:before {
    174154    position: absolute;
    175155    top: 8px;
     
    186166}
    187167
    188 .welcome-panel-content,
    189 .try-gutenberg-panel-content {
     168.welcome-panel-content {
    190169    margin: 0 13px;
    191170    max-width: 1500px;
    192 }
    193 
    194 .try-gutenberg-panel img {
    195     margin-top: 23px;
    196     width: calc( 100% - 40px );
    197     border: 1px solid #f3f4f5;
    198 }
    199 
    200 .try-gutenberg-panel .install-now.updating-message:before,
    201 .try-gutenberg-panel .install-now.updated-message:before {
    202     margin-top: 11px;
    203171}
    204172
     
    214182}
    215183
    216 .try-gutenberg-panel .try-gutenberg-panel-column > * {
    217     padding-right: 40px;
    218 }
    219 
    220184.ie8 .welcome-panel .welcome-panel-column {
    221185    min-width: 230px;
     
    226190}
    227191
    228 .try-gutenberg-panel .try-gutenberg-panel-column-container {
    229     display: flex;
    230     margin-bottom: 13px;
    231 }
    232 
    233 @supports (display: grid) {
    234     .try-gutenberg-panel .try-gutenberg-panel-column-container {
    235         display: -ms-grid;
    236         display: grid;
    237         -ms-grid-columns: 36% 32% 32%;
    238         grid-template-columns: 36% 32% 32%;
    239     }
    240 }
    241 
    242 .try-gutenberg-panel .try-gutenberg-panel-image-column {
    243     width: 36%;
    244 }
    245 
    246 @supports (display: grid) {
    247     .try-gutenberg-panel .try-gutenberg-panel-image-column {
    248         width: auto;
    249     }
    250 }
    251 
    252 .try-gutenberg-panel .try-gutenberg-panel-column:not(.try-gutenberg-panel-image-column) {
    253     display: flex;
    254     flex-direction: column;
    255     justify-content: space-between;
    256     width: 32%;
    257 }
    258 
    259 @supports (display: grid) {
    260     .try-gutenberg-panel .try-gutenberg-panel-column:not(.try-gutenberg-panel-image-column) {
    261         display: -ms-grid;
    262         display: grid;
    263         -ms-grid-rows: auto 100px;
    264         grid-template-rows: auto 100px;
    265         width: auto;
    266     }
    267 }
    268 
    269 .try-gutenberg-panel .try-gutenberg-action {
    270     height: 100px;
    271 }
    272 
    273 @supports (display: grid) {
    274     .try-gutenberg-panel .try-gutenberg-action {
    275         height: auto;
    276     }
    277 }
    278 
    279192.welcome-panel-column p.hide-if-no-customize {
    280193    margin-top: 10px;
    281194}
    282195
    283 .welcome-panel-column p,
    284 .try-gutenberg-panel-column p {
     196.welcome-panel-column p {
    285197    margin-top: 7px;
    286198    color: #444;
     
    12971209}
    12981210
    1299 @media screen and (max-width: 1024px) {
    1300     .try-gutenberg-panel .try-gutenberg-panel-column-container {
    1301         -ms-grid-columns: 50% 50%;
    1302         grid-template-columns: 50% 50%;
    1303     }
    1304 
    1305     .try-gutenberg-panel .try-gutenberg-panel-image-column {
    1306         display: none;
    1307     }
    1308 
    1309     .try-gutenberg-panel .try-gutenberg-panel-column:not(.try-gutenberg-panel-image-column) {
    1310         width: 50%;
    1311     }
    1312 
    1313     @supports (display: grid) {
    1314         .try-gutenberg-panel .try-gutenberg-panel-column:not(.try-gutenberg-panel-image-column) {
    1315             width: auto;
    1316         }
    1317     }
    1318 }
    1319 
    13201211@media screen and (max-width: 870px) {
    13211212    .welcome-panel .welcome-panel-column,
     
    13231214        display: block;
    13241215        float: none;
    1325         width: 100%;
    1326     }
    1327 
    1328     .try-gutenberg-panel .try-gutenberg-panel-column-container {
    1329         flex-wrap: wrap;
    1330     }
    1331 
    1332     @supports (display: grid) {
    1333         .try-gutenberg-panel .try-gutenberg-panel-column-container {
    1334             -ms-grid-columns: 100%;
    1335             grid-template-columns: 100%;
    1336         }
    1337     }
    1338 
    1339     .try-gutenberg-panel .try-gutenberg-panel-column:not(.try-gutenberg-panel-image-column) {
    13401216        width: 100%;
    13411217    }
     
    13911267@media screen and (max-width: 600px) {
    13921268    /* Keep the close icon from overlapping the Welcome text. */
    1393     .welcome-panel .welcome-panel-close,
    1394     .try-gutenberg-panel .try-gutenberg-panel-close {
     1269    .welcome-panel .welcome-panel-close {
    13951270        overflow: hidden;
    13961271        text-indent: 40px;
     
    14041279
    14051280    /* Make the close icon larger for tappability. */
    1406     .welcome-panel .welcome-panel-close:before,
    1407     .try-gutenberg-panel .try-gutenberg-panel-close:before {
     1281    .welcome-panel .welcome-panel-close:before {
    14081282        font-size: 20px;
    14091283        top: 5px;
  • branches/4.9/src/wp-admin/includes/ajax-actions.php

    r44053 r44106  
    14861486
    14871487/**
    1488  * Ajax handler for updating whether to display the Try Gutenberg panel.
    1489  *
    1490  * @since 4.9.8
    1491  */
    1492 function wp_ajax_update_try_gutenberg_panel() {
    1493     check_ajax_referer( 'try-gutenberg-panel-nonce', 'trygutenbergpanelnonce' );
    1494 
    1495     update_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', empty( $_POST['visible'] ) ? 0 : 1 );
    1496 
    1497     wp_die( 1 );
    1498 }
    1499 
    1500 /**
    15011488 * Ajax handler for retrieving menu meta boxes.
    15021489 *
  • branches/4.9/src/wp-admin/includes/class-wp-screen.php

    r44051 r44106  
    10351035            }
    10361036
    1037             if ( 'dashboard' === $this->id && has_action( 'try_gutenberg_panel' ) ) {
    1038                 if ( isset( $_GET['try_gutenberg'] ) ) {
    1039                     $try_gutenberg_checked = empty( $_GET['try_gutenberg'] ) ? 0 : 1;
    1040                     update_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', $try_gutenberg_checked );
    1041                 } else {
    1042                     $try_gutenberg_checked = get_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', true );
    1043                     if ( '' === $try_gutenberg_checked ) {
    1044                         $try_gutenberg_checked = '1';
    1045                     }
    1046                     if ( '2' === $try_gutenberg_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) {
    1047                         $try_gutenberg_checked = false;
    1048                     }
    1049                 }
    1050                 echo '<label for="wp_try_gutenberg_panel-hide">';
    1051                 echo '<input type="checkbox" id="wp_try_gutenberg_panel-hide"' . checked( (bool) $try_gutenberg_checked, true, false ) . ' />';
    1052                 echo __( 'New Editor' ) . "</label>\n";
    1053             }
    10541037        ?>
    10551038        </fieldset>
  • branches/4.9/src/wp-admin/includes/dashboard.php

    r43544 r44106  
    2424
    2525    /* Register Widgets and Controls */
    26 
    27     // Try Gutenberg
    28 
    29     // If Gutenberg isn't activated, only show the panel to users who can install and activate it.
    30     $plugins = get_plugins();
    31     if ( is_plugin_inactive( 'gutenberg/gutenberg.php' ) && ! current_user_can( 'install_plugins' ) ) {
    32         remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );
    33     }
    34     // If Gutenberg is activated, only show it to users who can use it.
    35     if ( is_plugin_active( 'gutenberg/gutenberg.php' ) && ! current_user_can( 'edit_posts' ) ) {
    36         remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );
    37     }
    3826
    3927    $response = wp_check_browser_version();
     
    16321620    <?php
    16331621}
    1634 
    1635 /**
    1636  * Displays a Try Gutenberg Panel, to introduce people to Gutenberg
    1637  *
    1638  * @since 4.9.8
    1639  */
    1640 function wp_try_gutenberg_panel() {
    1641     $plugins = get_plugins();
    1642     $action = $url = $classes = '';
    1643     $classic_action = $classic_url = $classic_classes = '';
    1644 
    1645     if ( current_user_can( 'install_plugins' ) ) {
    1646         if ( empty( $plugins['gutenberg/gutenberg.php'] ) ) {
    1647             if ( get_filesystem_method( array(), WP_PLUGIN_DIR ) === 'direct' ) {
    1648                 $action = __( 'Install Gutenberg' );
    1649                 $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=gutenberg' ), 'install-plugin_gutenberg' );
    1650                 $classes = ' install-now';
    1651             }
    1652         } else if ( is_plugin_inactive( 'gutenberg/gutenberg.php' ) ) {
    1653             $action = __( 'Activate Gutenberg' );
    1654             $url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=gutenberg/gutenberg.php&from=try-gutenberg' ), 'activate-plugin_gutenberg/gutenberg.php' );
    1655             $classes = ' activate-now';
    1656         }
    1657 
    1658         if ( empty( $plugins['classic-editor/classic-editor.php'] ) ) {
    1659             if ( get_filesystem_method( array(), WP_PLUGIN_DIR ) === 'direct' ) {
    1660                 $classic_action = __( 'Install the Classic Editor' );
    1661                 $classic_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=classic-editor' ), 'install-plugin_classic-editor' );
    1662                 $classic_classes = ' install-now';
    1663             }
    1664         } else if ( is_plugin_inactive( 'classic-editor/classic-editor.php' ) ) {
    1665             $classic_action = __( 'Activate the Classic Editor' );
    1666             $classic_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php&from=try-gutenberg' ), 'activate-plugin_classic-editor/classic-editor.php' );
    1667             $classic_classes = ' activate-now';
    1668         } else {
    1669             $classic_action = __( 'The Classic Editor is activated' );
    1670             $classic_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php&from=try-gutenberg' ), 'activate-plugin_classic-editor/classic-editor.php' );;
    1671             $classic_classes = ' button-disabled install-now updated-message';
    1672         }
    1673     }
    1674 
    1675     if ( current_user_can( 'edit_posts' ) && is_plugin_active( 'gutenberg/gutenberg.php' ) ) {
    1676         $action = __( 'Try Gutenberg' );
    1677         $url = admin_url( 'admin.php?page=gutenberg' );
    1678     }
    1679 
    1680     ?>
    1681     <div class="try-gutenberg-panel-content">
    1682         <h2><?php _e( 'A new, modern publishing experience is coming soon.' ); ?></h2>
    1683 
    1684         <p class="about-description"><?php _e( "Take your words, media, and layout in new directions with Gutenberg, the WordPress editor we're currently building." ); ?></p>
    1685 
    1686         <hr />
    1687 
    1688         <div class="try-gutenberg-panel-column-container">
    1689             <div class="try-gutenberg-panel-column try-gutenberg-panel-image-column">
    1690                 <picture>
    1691                     <source srcset="about:blank" media="(max-width: 1024px)">
    1692                     <img src="https://s.w.org/images/core/gutenberg-screenshot.png?<?php echo date( 'Ymd' ); ?>" alt="<?php esc_attr_e( 'Screenshot from the Gutenberg interface' ); ?>" />
    1693                 </picture>
    1694             </div>
    1695             <div class="try-gutenberg-panel-column plugin-card-gutenberg">
    1696 
    1697                 <div>
    1698                     <h3><?php _e( 'Test the new editor today.' ); ?></h3>
    1699 
    1700                     <p>
    1701                         <?php _e( "You can take Gutenberg for a spin (and share your feedback, if you’d like) before we officially release it, by installing it as a plugin." ); ?>
    1702                         <?php
    1703                             printf(
    1704                                 /* translators: 1: Gutenberg call for testing handbook link, 2: Gutenberg GitHub repository issues link, 3: Gutenberg GitHub repository CONTRIBUTING.md link */
    1705                                 __( 'You can help by <a href="%1$s">testing</a>, <a href="%2$s">filing bugs</a>, or contributing on the <a href="%3$s">GitHub repository</a>.' ),
    1706                                 'https://make.wordpress.org/test/handbook/call-for-testing/gutenberg-testing/',
    1707                                 'https://github.com/WordPress/gutenberg/issues',
    1708                                 'https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md'
    1709                             );
    1710                         ?>
    1711                     </p>
    1712                 </div>
    1713 
    1714                 <div class="try-gutenberg-action">
    1715                     <?php if ( $action ) { ?>
    1716                         <p><a class="button button-primary button-hero<?php echo $classes; ?>" href="<?php echo esc_url( $url ); ?>" data-name="<?php esc_attr_e( 'Gutenberg' ); ?>" data-slug="gutenberg"><?php echo $action; ?></a></p>
    1717                     <?php } ?>
    1718 
    1719                     <p>
    1720                         <?php
    1721                             $learnmore = sprintf(
    1722                                 /* translators: Link to https://wordpress.org/gutenberg/ */
    1723                                 __( '<a href="%s">Learn more about Gutenberg</a>' ),
    1724                                 __( 'https://wordpress.org/gutenberg/' )
    1725                             );
    1726 
    1727                             /**
    1728                              * Filters the "Learn more" link in the Try Gutenberg panel.
    1729                              *
    1730                              * It allows hosts or site owners to change the link, to provide extra
    1731                              * information about Gutenberg, specific to their service.
    1732                              *
    1733                              * WARNING: This filter will only exist in the 4.9.x series, it will not be
    1734                              * added to WordPress 5.0 and later.
    1735                              *
    1736                              * @since 4.9.8
    1737                              */
    1738                             echo apply_filters( 'try_gutenberg_learn_more_link', $learnmore );
    1739                         ?>
    1740                     </p>
    1741                 </div>
    1742             </div>
    1743 
    1744             <div class="try-gutenberg-panel-column plugin-card-classic-editor">
    1745 
    1746                 <div>
    1747                     <h3><?php _e( 'Not quite ready?' ); ?></h3>
    1748 
    1749                     <p>
    1750                         <?php _e( 'The new editor will be enabled by default in the next major release of WordPress. If you’re not sure how compatible your current themes and plugins are, we’ve got you covered.' ); ?>
    1751                         <?php
    1752                             printf(
    1753                                 /* translators: Link to the Classic Editor plugin page */
    1754                                 __( 'Install the <a href="%s">Classic Editor plugin</a> to keep using the current editor until you’re ready to make the switch.' ),
    1755                                 __( 'https://wordpress.org/plugins/classic-editor' )
    1756                             );
    1757                         ?>
    1758                     </p>
    1759                 </div>
    1760 
    1761                 <?php if ( $classic_action ) { ?>
    1762                     <div class="try-gutenberg-action">
    1763                         <p><a class="button button-secondary button-hero<?php echo $classic_classes; ?>" href="<?php echo esc_url( $classic_url ); ?>" data-name="<?php esc_attr_e( 'Classic Editor' ); ?>" data-slug="classic-editor"><?php echo $classic_action; ?></a></p>
    1764                     </div>
    1765                 <?php } ?>
    1766             </div>
    1767         </div>
    1768     </div>
    1769     <?php
    1770 }
  • branches/4.9/src/wp-admin/index.php

    r43502 r44106  
    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     // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
    111     $hide = '0' === $option || ( '2' === $option && wp_get_current_user()->user_email !== get_option( 'admin_email' ) );
    112     if ( $hide )
    113         $classes .= ' hidden'; ?>
    114 
    115     <div id="try-gutenberg-panel" class="<?php echo esc_attr( $classes ); ?>">
    116         <?php wp_nonce_field( 'try-gutenberg-panel-nonce', 'trygutenbergpanelnonce', false ); ?>
    117         <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>
    118         <?php
    119         /**
    120          * Add content to the Try Gutenberg panel on the admin dashboard.
    121          *
    122          * To remove the Try Gutenberg panel, use remove_action():
    123          *
    124          *     remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );
    125          *
    126          * @since 4.9.8
    127          */
    128         do_action( 'try_gutenberg_panel' );
    129         ?>
    130     </div>
    131 <?php endif; ?>
    132106<?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
    133107    $classes = 'welcome-panel';
  • branches/4.9/src/wp-admin/js/dashboard.js

    r43502 r44106  
    3131        updateWelcomePanel( this.checked ? 1 : 0 );
    3232    });
    33 
    34     var tryGutenbergPanel = $( '#try-gutenberg-panel' ),
    35         tryGutenbergPanelHide = $('#wp_try_gutenberg_panel-hide'),
    36         updateTryGutenbergPanel, installGutenbergSuccess;
    37 
    38     updateTryGutenbergPanel = function( visible ) {
    39         $.post( ajaxurl, {
    40             action: 'update-try-gutenberg-panel',
    41             visible: visible,
    42             trygutenbergpanelnonce: $( '#trygutenbergpanelnonce' ).val()
    43         });
    44     };
    45 
    46     installGutenbergSuccess = function( response ) {
    47         response.activateUrl += '&from=try-gutenberg';
    48         response.activateLabel = wp.updates.l10n.activatePluginLabel.replace( '%s', response.pluginName );
    49         wp.updates.installPluginSuccess( response );
    50     };
    51 
    52     if ( tryGutenbergPanel.hasClass( 'hidden' ) && tryGutenbergPanelHide.prop( 'checked' ) ) {
    53         tryGutenbergPanel.removeClass( 'hidden' );
    54     }
    55 
    56     $( '.try-gutenberg-panel-close, .try-gutenberg-panel-dismiss a', tryGutenbergPanel ).click( function( e ) {
    57         e.preventDefault();
    58         tryGutenbergPanel.addClass( 'hidden' );
    59         updateTryGutenbergPanel( 0 );
    60         $('#wp_try_gutenberg_panel-hide').prop( 'checked', false );
    61     });
    62 
    63     tryGutenbergPanelHide.click( function() {
    64         tryGutenbergPanel.toggleClass( 'hidden', ! this.checked );
    65         updateTryGutenbergPanel( this.checked ? 1 : 0 );
    66     });
    67 
    68     tryGutenbergPanel.on( 'click', '.install-now', function( e ) {
    69         e.preventDefault();
    70         var args = {
    71             slug: $( e.target ).data( 'slug' ),
    72             success: installGutenbergSuccess
    73         };
    74         wp.updates.installPlugin( args );
    75     } );
    7633
    7734    // These widgets are sometimes populated via ajax
  • branches/4.9/src/wp-admin/plugins.php

    r43502 r44106  
    6666            } else if ( isset($_GET['from']) && 'press-this' == $_GET['from'] ) {
    6767                wp_redirect( self_admin_url( "press-this.php") );
    68             } else if ( isset( $_GET['from'] ) && 'try-gutenberg' == $_GET['from'] ) {
    69                 if ( 'gutenberg/gutenberg.php' === $plugin ) {
    70                     wp_redirect( self_admin_url( "admin.php?page=gutenberg" ) );
    71                 } else {
    72                     wp_redirect( self_admin_url() );
    73                 }
    7468            } else {
    7569                wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above
  • branches/4.9/src/wp-includes/default-filters.php

    r43502 r44106  
    319319add_action( 'comment_form',               'wp_comment_form_unfiltered_html_nonce'          );
    320320add_action( 'admin_init',                 'send_frame_options_header',               10, 0 );
    321 add_action( 'try_gutenberg_panel',        'wp_try_gutenberg_panel'                         );
    322321add_action( 'welcome_panel',              'wp_welcome_panel'                               );
    323322
Note: See TracChangeset for help on using the changeset viewer.