Make WordPress Core

Ticket #35833: 35833.diff

File 35833.diff, 4.3 KB (added by Braad, 8 years ago)

Improved patch that uses table.wp-list-table in place of table.widefat for both post and taxonomy edit screens

  • src/wp-admin/js/inline-edit-post.js

     
    88        init : function(){
    99                var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit');
    1010
    11                 t.type = $('table.widefat').hasClass('pages') ? 'page' : 'post';
     11                t.type = $('table.wp-list-table').hasClass('pages') ? 'page' : 'post';
    1212                t.what = '#post-';
    1313
    1414                // prepare the edit rows
     
    8686                var te = '', type = this.type, tax, c = true;
    8787                this.revert();
    8888
    89                 $( '#bulk-edit td' ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length );
     89                $( '#bulk-edit td' ).attr( 'colspan', $( 'th:visible, td:visible', 'table.wp-list-table:first thead' ).length );
    9090                // Insert the editor at the top of the table with an empty row above to maintain zebra striping.
    91                 $('table.widefat tbody').prepend( $('#bulk-edit') ).prepend('<tr class="hidden"></tr>');
     91                $('table.wp-list-table tbody').prepend( $('#bulk-edit') ).prepend('<tr class="hidden"></tr>');
    9292                $('#bulk-edit').addClass('inline-editor').show();
    9393
    9494                $( 'tbody th.check-column input[type="checkbox"]' ).each( function() {
     
    108108                $('#bulk-titles a').click(function(){
    109109                        var id = $(this).attr('id').substr(1);
    110110
    111                         $('table.widefat input[value="' + id + '"]').prop('checked', false);
     111                        $('table.wp-list-table input[value="' + id + '"]').prop('checked', false);
    112112                        $('#ttle'+id).remove();
    113113                });
    114114
     
    136136
    137137                // add the new edit row with an extra blank row underneath to maintain zebra striping.
    138138                editRow = $('#inline-edit').clone(true);
    139                 $( 'td', editRow ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length );
     139                $( 'td', editRow ).attr( 'colspan', $( 'th:visible, td:visible', 'table.wp-list-table:first thead' ).length );
    140140
    141141                $(t.what+id).removeClass('is-expanded').hide().after(editRow).after('<tr class="hidden"></tr>');
    142142
     
    248248                        id = this.getId(id);
    249249                }
    250250
    251                 $( 'table.widefat .spinner' ).addClass( 'is-active' );
     251                $( 'table.wp-list-table .spinner' ).addClass( 'is-active' );
    252252
    253253                params = {
    254254                        action: 'inline-save',
     
    266266                        function(r) {
    267267                                var $errorSpan = $( '#edit-' + id + ' .inline-edit-save .error' );
    268268
    269                                 $( 'table.widefat .spinner' ).removeClass( 'is-active' );
     269                                $( 'table.wp-list-table .spinner' ).removeClass( 'is-active' );
    270270                                $( '.ac_results' ).hide();
    271271
    272272                                if (r) {
     
    295295
    296296        // Revert is for both Quick Edit and Bulk Edit.
    297297        revert : function(){
    298                 var $tableWideFat = $( '.widefat' ),
     298                var $tableWideFat = $( 'table.wp-list-table' ),
    299299                        id = $( '.inline-editor', $tableWideFat ).attr( 'id' );
    300300
    301301                if ( id ) {
  • src/wp-admin/js/inline-edit-tax.js

     
    5555                }
    5656
    5757                editRow = $('#inline-edit').clone(true), rowData = $('#inline_'+id);
    58                 $( 'td', editRow ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length );
     58                $( 'td', editRow ).attr( 'colspan', $( 'th:visible, td:visible', 'table.wp-list-table:first thead' ).length );
    5959
    6060                $(t.what+id).hide().after(editRow).after('<tr class="hidden"></tr>');
    6161
     
    8282                        id = this.getId(id);
    8383                }
    8484
    85                 $( 'table.widefat .spinner' ).addClass( 'is-active' );
     85                $( 'table.wp-list-table .spinner' ).addClass( 'is-active' );
    8686
    8787                params = {
    8888                        action: 'inline-save-tax',
     
    100100                                var row, new_id, option_value,
    101101                                        $errorSpan = $( '#edit-' + id + ' .inline-edit-save .error' );
    102102
    103                                 $( 'table.widefat .spinner' ).removeClass( 'is-active' );
     103                                $( 'table.wp-list-table .spinner' ).removeClass( 'is-active' );
    104104
    105105                                if (r) {
    106106                                        if ( -1 !== r.indexOf( '<tr' ) ) {
     
    142142        },
    143143
    144144        revert : function() {
    145                 var id = $('table.widefat tr.inline-editor').attr('id');
     145                var id = $('table.wp-list-table tr.inline-editor').attr('id');
    146146
    147147                if ( id ) {
    148                         $( 'table.widefat .spinner' ).removeClass( 'is-active' );
     148                        $( 'table.wp-list-table .spinner' ).removeClass( 'is-active' );
    149149                        $('#'+id).siblings('tr.hidden').addBack().remove();
    150150                        id = id.substr( id.lastIndexOf('-') + 1 );
    151151                        // Show the taxonomy row and move focus back to the Quick Edit link.