Make WordPress Core

Ticket #31634: 31634.3.diff

File 31634.3.diff, 4.2 KB (added by wonderboymusic, 9 years ago)
  • src/wp-admin/includes/class-wp-list-table.php

     
    436436                        return;
    437437
    438438                echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . __( 'Select bulk action' ) . "</label>";
    439                 echo "<select name='action$two' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
    440                 echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
     439                echo "<select name='action$two' id='bulk-action-selector-" . esc_attr( $which ) . "' disabled='disabled'>\n";
     440                echo "<option value='-1'>" . __( 'Bulk Actions' ) . "</option>\n";
    441441
    442442                foreach ( $this->_actions as $name => $title ) {
    443443                        $class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
     
    447447
    448448                echo "</select>\n";
    449449
    450                 submit_button( __( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two" ) );
     450                submit_button( __( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two", 'disabled' => 'disabled' ) );
    451451                echo "\n";
    452452        }
    453453
  • src/wp-admin/includes/update-core.php

     
    279279'wp-admin/images/logo-login.gif',
    280280'wp-admin/images/star.gif',
    281281'wp-admin/js/list-table.dev.js',
    282 'wp-admin/js/list-table.js',
     282//'wp-admin/js/list-table.js', // restored in 4.4
    283283'wp-includes/default-embeds.php',
    284284'wp-includes/js/tinymce/plugins/wordpress/img/help.gif',
    285285'wp-includes/js/tinymce/plugins/wordpress/img/more.gif',
  • src/wp-admin/js/list-table.js

     
     1/*globals jQuery */
     2
     3(function ($) {
     4        "use strict";
     5
     6        var listTable,
     7                actions,
     8                doActions;
     9
     10        function getChecked() {
     11                return listTable.find('table .check-column input[type="checkbox"]:checked' );
     12        }
     13
     14        /**
     15         * Enable and Disable Apply button in wp-list
     16         *
     17         * @param {jQuery.Event} e
     18         */
     19        function setApplyButton( e ) {
     20                var checked = getChecked().length;
     21
     22                if ( 'SELECT' === e.target.tagName ) {
     23                        actions.val( e.target.value );
     24                }
     25
     26                actions.prop( 'disabled', ! checked );
     27                doActions.prop( 'disabled', ! checked || -1 === parseInt( actions.val(), 10 ) );
     28        }
     29
     30    $(document).ready(function () {
     31                listTable = $('.wp-list-table').closest('form');
     32                if ( ! listTable.length ) {
     33                        return;
     34                }
     35
     36                actions = listTable.find( 'select[name="action"], select[name="action2"]' )
     37                        .on( 'change', setApplyButton );
     38
     39                doActions = listTable.find( '#doaction, #doaction2' );
     40
     41                listTable.find( 'table' ).on( 'click', '.check-column :checkbox', setApplyButton );
     42    });
     43
     44}(jQuery));
     45 No newline at end of file
  • src/wp-includes/script-loader.php

     
    7777                'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ),
    7878        ) );
    7979
    80         $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 );
     80        $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils', 'list-table'), false, 1 );
    8181        did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array(
    8282                'warnDelete' => __( "You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete." ),
    8383                'dismiss'    => __( 'Dismiss this notice.' ),
     
    396396
    397397        $scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );
    398398
     399        $scripts->add( 'list-table', "/wp-admin/js/list-table$suffix.js", array( 'jquery' ), false, 1 );
     400
    399401        $scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array(), false, 1 );
    400402
    401403        $scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery' ), false, 1 );