WordPress.org

Make WordPress Core

Ticket #15318: colspan_magic.patch

File colspan_magic.patch, 5.1 KB (added by ocean90, 9 years ago)
  • wp-admin/includes/class-wp-posts-list-table.php

     
    720720
    721721                <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-$screen->post_type ";
    722722                        echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit-$screen->post_type" : "quick-edit-row quick-edit-row-$hclass inline-edit-$screen->post_type";
    723                 ?>" style="display: none"><td colspan="<?php echo $col_count; ?>">
     723                ?>" style="display: none"><td colspan="<?php echo $col_count; ?>" class="colspanchange">
    724724
    725725                <fieldset class="inline-edit-col-left"><div class="inline-edit-col">
    726726                        <h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>
  • wp-admin/includes/class-wp-terms-list-table.php

     
    315315                ?>
    316316
    317317        <form method="get" action=""><table style="display: none"><tbody id="inlineedit">
    318                 <tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $col_count; ?>">
     318                <tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $col_count; ?>" class="colspanchange">
    319319
    320320                        <fieldset><div class="inline-edit-col">
    321321                                <h4><?php _e( 'Quick Edit' ); ?></h4>
  • wp-admin/includes/update.php

     
    192192
    193193        $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');
    194194
     195        $wp_list_table = get_list_table('WP_Plugins_List_Table');
     196        list ( $columns, $hidden ) = $wp_list_table->get_column_info();
     197        $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
     198        $col_count = count($columns) - count($hidden);
     199
    195200        if ( is_network_admin() || !is_multisite() ) {
    196                 echo '<tr class="plugin-update-tr"><td colspan="3" class="plugin-update"><div class="update-message">';
     201                echo '<tr class="plugin-update-tr"><td colspan="' . $col_count . '" class="plugin-update colspanchange"><div class="update-message">';
    197202                if ( ! current_user_can('update_plugins') )
    198203                        printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
    199204                else if ( empty($r->package) )
     
    266271
    267272        $details_url = self_admin_url("theme-install.php?tab=theme-information&theme=$theme_key&TB_iframe=true&width=600&height=400");
    268273
    269         echo '<tr class="plugin-update-tr"><td colspan="3" class="plugin-update"><div class="update-message">';
     274        $wp_list_table = get_list_table('WP_MS_Themes_List_Table');
     275        list ( $columns, $hidden ) = $wp_list_table->get_column_info();
     276        $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
     277        $col_count = count($columns) - count($hidden);
     278
     279        echo '<tr class="plugin-update-tr"><td colspan="' . $col_count . '" class="plugin-update colspanchange"><div class="update-message">';
    270280        if ( ! current_user_can('update_themes') )
    271281                printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r->new_version );
    272282        else if ( empty( $r['package'] ) )
  • wp-admin/includes/template.php

     
    338338?>
    339339<form method="get" action="">
    340340<?php if ( $table_row ) : ?>
    341 <table style="display:none;"><tbody id="com-reply"><tr id="replyrow" style="display:none;"><td colspan="<?php echo $col_count; ?>">
     341<table style="display:none;"><tbody id="com-reply"><tr id="replyrow" style="display:none;"><td colspan="<?php echo $col_count; ?>" class="colspanchange">
    342342<?php else : ?>
    343343<div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;">
    344344<?php endif; ?>
  • wp-admin/js/common.dev.js

     
    147147
    148148        checked : function(column) {
    149149                $('.column-' + column).show();
     150                this.colSpanChange(+1);
    150151        },
    151152
    152153        unchecked : function(column) {
    153154                $('.column-' + column).hide();
     155                this.colSpanChange(-1);
    154156        },
    155157
    156158        hidden : function() {
     
    164166                                return id.substring( id, id.length - 5 );
    165167                        }).get().join(',');
    166168                };
     169        },
     170       
     171        colSpanChange : function(diff) {
     172                var $t = $('table').find('.colspanchange');
     173                if ( !$t.length )
     174                        return;
     175                var n = parseInt( $t.attr('colspan'), 10 ) + diff;
     176                $t.attr('colspan', n.toString());
    167177        }
    168178}
    169179