WordPress.org

Make WordPress Core

Changeset 16553


Ignore:
Timestamp:
11/23/2010 08:17:22 PM (9 years ago)
Author:
scribu
Message:

Ajaxify theme feature filter. Props ocean90 for initial patch. See #14936

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/theme.dev.js

    r16540 r16553  
    55
    66        function filter_count() {
    7             var count = $( '#filters :checked' ).length;
     7            var count = $( '#filter-box :checked' ).length;
    88            var text  = $( '#filter-click' ).text();
    99
     
    2020            $( '#filter-click, #mini-filter-click' ).unbind( 'click' ).click( function() {
    2121                $( '#filter-click' ).toggleClass( 'current' );
    22                 $( '#filters' ).slideToggle();
     22                $( '#filter-box' ).slideToggle();
    2323                $( '#current-theme' ).slideToggle( 300 );
    2424                return false;
    2525            });
    2626
    27             $( '#filters :checkbox' ).unbind( 'click' ).click( function() {
     27            $( '#filter-box :checkbox' ).unbind( 'click' ).click( function() {
    2828                filter_count();
     29            });
     30
     31            $('#filter-box :submit').unbind( 'click' ).click(function() {
     32                var features = [];
     33                $('#filter-box :checked').each(function() {
     34                    features.push($(this).val());
     35                });
     36
     37                listTable.update_rows({'features': features}, true, function() {
     38                    $( '#filter-click' ).toggleClass( 'current' );
     39                    $( '#filter-box' ).slideToggle();
     40                    $( '#current-theme' ).slideToggle( 300 );
     41                });
     42               
     43                return false;
    2944            });
    3045        }
  • trunk/wp-admin/js/theme.js

    r16540 r16553  
    1 var ThemeViewer;(function(a){ThemeViewer=function(b){function d(){var f=a("#filters :checked").length;var g=a("#filter-click").text();if(g.indexOf("(")!=-1){g=g.substr(0,g.indexOf("("))}if(f==0){a("#filter-click").text(g)}else{a("#filter-click").text(g+" ("+f+")")}}function e(){a("#filter-click, #mini-filter-click").unbind("click").click(function(){a("#filter-click").toggleClass("current");a("#filters").slideToggle();a("#current-theme").slideToggle(300);return false});a("#filters :checkbox").unbind("click").click(function(){d()})}var c={init:e};return c}})(jQuery);jQuery(document).ready(function(a){theme_viewer=new ThemeViewer();theme_viewer.init()});
     1var ThemeViewer;(function(a){ThemeViewer=function(b){function d(){var f=a("#filter-box :checked").length;var g=a("#filter-click").text();if(g.indexOf("(")!=-1){g=g.substr(0,g.indexOf("("))}if(f==0){a("#filter-click").text(g)}else{a("#filter-click").text(g+" ("+f+")")}}function e(){a("#filter-click, #mini-filter-click").unbind("click").click(function(){a("#filter-click").toggleClass("current");a("#filter-box").slideToggle();a("#current-theme").slideToggle(300);return false});a("#filter-box :checkbox").unbind("click").click(function(){d()});a("#filter-box :submit").unbind("click").click(function(){var f=[];a("#filter-box :checked").each(function(){f.push(a(this).val())});listTable.update_rows({features:f},true,function(){a("#filter-click").toggleClass("current");a("#filter-box").slideToggle();a("#current-theme").slideToggle(300)});return false})}var c={init:e};return c}})(jQuery);jQuery(document).ready(function(a){theme_viewer=new ThemeViewer();theme_viewer.init()});
  • trunk/wp-admin/themes.php

    r16175 r16553  
    130130<h3><?php _e('Available Themes'); ?></h3>
    131131
    132 <form class="search-form" action="" method="get">
     132<form class="search-form filter-form" action="" method="get">
    133133<p class="search-box">
    134134    <label class="screen-reader-text" for="theme-search-input"><?php _e('Search Themes'); ?>:</label>
     
    140140<br class="clear"/>
    141141
    142 <div id="filters" style="display: none;">
     142<div id="filter-box" style="display: none;">
    143143<?php $feature_list = get_theme_feature_list(); ?>
    144144    <div class="feature-filter">
     
    155155                        $feature_name = $feature;
    156156                        $feature_name = esc_html( $feature_name );
    157                         $feature = esc_attr($feature);
     157                        $feature = esc_attr( $feature );
    158158                        ?>
    159159                <li>
    160                     <input type="checkbox" name="features[<?php echo $key; ?>]" id="feature-id-<?php echo $key; ?>" value="<?php echo $key; ?>" <?php checked( in_array( $key, $wp_list_table->features ) ); ?>/>
     160                    <input type="checkbox" name="features[]" id="feature-id-<?php echo $key; ?>" value="<?php echo $key; ?>" <?php checked( in_array( $key, $wp_list_table->features ) ); ?>/>
    161161                    <label for="feature-id-<?php echo $key; ?>"><?php echo $feature_name; ?></label>
    162162                </li>
  • trunk/wp-includes/script-loader.php

    r16540 r16553  
    304304        $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
    305305        $scripts->add_data( 'admin-custom-fields', 'group', 1 );
     306
     307        $scripts->add( 'list-table', "/wp-admin/js/list-table$suffix.js", array( 'jquery-query', 'jquery-serialize-object' ), '20101121' );
     308        $scripts->add_data( 'list-table', 'group', 1 );
     309        $scripts->localize( 'list-table', 'listTableL10n', array(
     310            'loading' => __('Loading...'),
     311            'error' => __('An error has occurred while loading the items.'),
     312            'search' => __('Search results for &#8220;%s&#8221;'),
     313            'l10n_print_after' => 'try{convertEntities(listTableL10n);}catch(e){};'
     314        ) );
    306315
    307316        $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'list-table', 'jquery-ui-resizable', 'quicktags'), '20101121' );
     
    374383        ));
    375384
    376         $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'thickbox', 'jquery' ), '20101123' );
     385        $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'thickbox', 'list-table' ), '20101123' );
    377386        $scripts->add_data( 'theme', 'group', 1 );
    378387
    379388        $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20100407' );
    380389        $scripts->add_data( 'theme-preview', 'group', 1 );
    381 
    382         $scripts->add( 'list-table', "/wp-admin/js/list-table$suffix.js", array( 'jquery-query', 'jquery-serialize-object' ), '20101121' );
    383         $scripts->add_data( 'list-table', 'group', 1 );
    384         $scripts->localize( 'list-table', 'listTableL10n', array(
    385             'loading' => __('Loading...'),
    386             'error' => __('An error has occurred while loading the items.'),
    387             'search' => __('Search results for &#8220;%s&#8221;'),
    388             'l10n_print_after' => 'try{convertEntities(listTableL10n);}catch(e){};'
    389         ) );
    390390
    391391        $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), '20100707' );
Note: See TracChangeset for help on using the changeset viewer.