<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16553] trunk: Ajaxify theme feature filter.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16553">16553</a></dd>
<dt>Author</dt> <dd>scribu</dd>
<dt>Date</dt> <dd>2010-11-23 20:17:22 +0000 (Tue, 23 Nov 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Ajaxify theme feature filter. Props ocean90 for initial patch. See <a href="http://trac.wordpress.org/ticket/14936">#14936</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminjsthemedevjs">trunk/wp-admin/js/theme.dev.js</a></li>
<li><a href="#trunkwpadminjsthemejs">trunk/wp-admin/js/theme.js</a></li>
<li><a href="#trunkwpadminthemesphp">trunk/wp-admin/themes.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminjsthemedevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/theme.dev.js (16552 => 16553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/theme.dev.js        2010-11-23 19:37:31 UTC (rev 16552)
+++ trunk/wp-admin/js/theme.dev.js        2010-11-23 20:17:22 UTC (rev 16553)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx">         ThemeViewer = function( args ) {
</span><span class="cx"> 
</span><span class="cx">                 function filter_count() {
</span><del>-                        var count = $( '#filters :checked' ).length;
</del><ins>+                        var count = $( '#filter-box :checked' ).length;
</ins><span class="cx">                         var text  = $( '#filter-click' ).text();
</span><span class="cx"> 
</span><span class="cx">                         if ( text.indexOf( '(' ) != -1 )
</span><span class="lines">@@ -19,14 +19,29 @@
</span><span class="cx">                 function init() {
</span><span class="cx">                         $( '#filter-click, #mini-filter-click' ).unbind( 'click' ).click( function() {
</span><span class="cx">                                 $( '#filter-click' ).toggleClass( 'current' );
</span><del>-                                $( '#filters' ).slideToggle();
</del><ins>+                                $( '#filter-box' ).slideToggle();
</ins><span class="cx">                                 $( '#current-theme' ).slideToggle( 300 );
</span><span class="cx">                                 return false;
</span><span class="cx">                         });
</span><span class="cx"> 
</span><del>-                        $( '#filters :checkbox' ).unbind( 'click' ).click( function() {
</del><ins>+                        $( '#filter-box :checkbox' ).unbind( 'click' ).click( function() {
</ins><span class="cx">                                 filter_count();
</span><span class="cx">                         });
</span><ins>+
+                        $('#filter-box :submit').unbind( 'click' ).click(function() {
+                                var features = [];
+                                $('#filter-box :checked').each(function() {
+                                        features.push($(this).val());
+                                });
+
+                                listTable.update_rows({'features': features}, true, function() {
+                                        $( '#filter-click' ).toggleClass( 'current' );
+                                        $( '#filter-box' ).slideToggle();
+                                        $( '#current-theme' ).slideToggle( 300 );
+                                });
+                                
+                                return false;
+                        });
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // These are the functions we expose
</span></span></pre></div>
<a id="trunkwpadminjsthemejs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/theme.js (16552 => 16553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/theme.js        2010-11-23 19:37:31 UTC (rev 16552)
+++ trunk/wp-admin/js/theme.js        2010-11-23 20:17:22 UTC (rev 16553)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var ThemeViewer;(function(a){ThemeViewer=function(b){function d(){var f=a(&quot;#filters :checked&quot;).length;var g=a(&quot;#filter-click&quot;).text();if(g.indexOf(&quot;(&quot;)!=-1){g=g.substr(0,g.indexOf(&quot;(&quot;))}if(f==0){a(&quot;#filter-click&quot;).text(g)}else{a(&quot;#filter-click&quot;).text(g+&quot; (&quot;+f+&quot;)&quot;)}}function e(){a(&quot;#filter-click, #mini-filter-click&quot;).unbind(&quot;click&quot;).click(function(){a(&quot;#filter-click&quot;).toggleClass(&quot;current&quot;);a(&quot;#filters&quot;).slideToggle();a(&quot;#current-theme&quot;).slideToggle(300);return false});a(&quot;#filters :checkbox&quot;).unbind(&quot;click&quot;).click(function(){d()})}var c={init:e};return c}})(jQuery);jQuery(document).ready(function(a){theme_viewer=new ThemeViewer();theme_viewer.init()});
</del><span class="cx">\ No newline at end of file
</span><ins>+var ThemeViewer;(function(a){ThemeViewer=function(b){function d(){var f=a(&quot;#filter-box :checked&quot;).length;var g=a(&quot;#filter-click&quot;).text();if(g.indexOf(&quot;(&quot;)!=-1){g=g.substr(0,g.indexOf(&quot;(&quot;))}if(f==0){a(&quot;#filter-click&quot;).text(g)}else{a(&quot;#filter-click&quot;).text(g+&quot; (&quot;+f+&quot;)&quot;)}}function e(){a(&quot;#filter-click, #mini-filter-click&quot;).unbind(&quot;click&quot;).click(function(){a(&quot;#filter-click&quot;).toggleClass(&quot;current&quot;);a(&quot;#filter-box&quot;).slideToggle();a(&quot;#current-theme&quot;).slideToggle(300);return false});a(&quot;#filter-box :checkbox&quot;).unbind(&quot;click&quot;).click(function(){d()});a(&quot;#filter-box :submit&quot;).unbind(&quot;click&quot;).click(function(){var f=[];a(&quot;#filter-box :checked&quot;).each(function(){f.push(a(this).val())});listTable.update_rows({features:f},true,function(){a(&quot;#filter-click&quot;).toggleClass(&quot;current&quot;);a(&quot;#filter-box&quot;).slideToggle();a(&quot;#current-theme&quot;).slideToggle(300)});return false})}var c={init:e};return c}})(jQuery);jQuery(document).ready(function(a){theme_viewer=new ThemeViewer();theme_viewer.init()});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminthemesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/themes.php (16552 => 16553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/themes.php        2010-11-23 19:37:31 UTC (rev 16552)
+++ trunk/wp-admin/themes.php        2010-11-23 20:17:22 UTC (rev 16553)
</span><span class="lines">@@ -129,7 +129,7 @@
</span><span class="cx"> ?&gt;
</span><span class="cx"> &lt;h3&gt;&lt;?php _e('Available Themes'); ?&gt;&lt;/h3&gt;
</span><span class="cx"> 
</span><del>-&lt;form class=&quot;search-form&quot; action=&quot;&quot; method=&quot;get&quot;&gt;
</del><ins>+&lt;form class=&quot;search-form filter-form&quot; action=&quot;&quot; method=&quot;get&quot;&gt;
</ins><span class="cx"> &lt;p class=&quot;search-box&quot;&gt;
</span><span class="cx">         &lt;label class=&quot;screen-reader-text&quot; for=&quot;theme-search-input&quot;&gt;&lt;?php _e('Search Themes'); ?&gt;:&lt;/label&gt;
</span><span class="cx">         &lt;input type=&quot;text&quot; id=&quot;theme-search-input&quot; name=&quot;s&quot; value=&quot;&lt;?php _admin_search_query(); ?&gt;&quot; /&gt;
</span><span class="lines">@@ -139,7 +139,7 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;br class=&quot;clear&quot;/&gt;
</span><span class="cx"> 
</span><del>-&lt;div id=&quot;filters&quot; style=&quot;display: none;&quot;&gt;
</del><ins>+&lt;div id=&quot;filter-box&quot; style=&quot;display: none;&quot;&gt;
</ins><span class="cx"> &lt;?php $feature_list = get_theme_feature_list(); ?&gt;
</span><span class="cx">         &lt;div class=&quot;feature-filter&quot;&gt;
</span><span class="cx">                 &lt;p class=&quot;install-help&quot;&gt;&lt;?php _e('Theme filters') ?&gt;&lt;/p&gt;
</span><span class="lines">@@ -154,10 +154,10 @@
</span><span class="cx">                                 &lt;?php foreach ( $features as $key =&gt; $feature ) :
</span><span class="cx">                                                 $feature_name = $feature;
</span><span class="cx">                                                 $feature_name = esc_html( $feature_name );
</span><del>-                                                $feature = esc_attr($feature);
</del><ins>+                                                $feature = esc_attr( $feature );
</ins><span class="cx">                                                 ?&gt;
</span><span class="cx">                                 &lt;li&gt;
</span><del>-                                        &lt;input type=&quot;checkbox&quot; name=&quot;features[&lt;?php echo $key; ?&gt;]&quot; id=&quot;feature-id-&lt;?php echo $key; ?&gt;&quot; value=&quot;&lt;?php echo $key; ?&gt;&quot; &lt;?php checked( in_array( $key, $wp_list_table-&gt;features ) ); ?&gt;/&gt;
</del><ins>+                                        &lt;input type=&quot;checkbox&quot; name=&quot;features[]&quot; id=&quot;feature-id-&lt;?php echo $key; ?&gt;&quot; value=&quot;&lt;?php echo $key; ?&gt;&quot; &lt;?php checked( in_array( $key, $wp_list_table-&gt;features ) ); ?&gt;/&gt;
</ins><span class="cx">                                         &lt;label for=&quot;feature-id-&lt;?php echo $key; ?&gt;&quot;&gt;&lt;?php echo $feature_name; ?&gt;&lt;/label&gt;
</span><span class="cx">                                 &lt;/li&gt;
</span><span class="cx">                                 &lt;?php endforeach; ?&gt;
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (16552 => 16553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-11-23 19:37:31 UTC (rev 16552)
+++ trunk/wp-includes/script-loader.php        2010-11-23 20:17:22 UTC (rev 16553)
</span><span class="lines">@@ -304,6 +304,15 @@
</span><span class="cx">                 $scripts-&gt;add( 'admin-custom-fields', &quot;/wp-admin/js/custom-fields$suffix.js&quot;, array('wp-lists'), '20090106' );
</span><span class="cx">                 $scripts-&gt;add_data( 'admin-custom-fields', 'group', 1 );
</span><span class="cx"> 
</span><ins>+                $scripts-&gt;add( 'list-table', &quot;/wp-admin/js/list-table$suffix.js&quot;, array( 'jquery-query', 'jquery-serialize-object' ), '20101121' );
+                $scripts-&gt;add_data( 'list-table', 'group', 1 );
+                $scripts-&gt;localize( 'list-table', 'listTableL10n', array(
+                        'loading' =&gt; __('Loading...'),
+                        'error' =&gt; __('An error has occurred while loading the items.'),
+                        'search' =&gt; __('Search results for &amp;#8220;%s&amp;#8221;'),
+                        'l10n_print_after' =&gt; 'try{convertEntities(listTableL10n);}catch(e){};'
+                ) );
+
</ins><span class="cx">                 $scripts-&gt;add( 'admin-comments', &quot;/wp-admin/js/edit-comments$suffix.js&quot;, array('wp-lists', 'list-table', 'jquery-ui-resizable', 'quicktags'), '20101121' );
</span><span class="cx">                 $scripts-&gt;add_data( 'admin-comments', 'group', 1 );
</span><span class="cx">                 $scripts-&gt;localize( 'admin-comments', 'adminCommentsL10n', array(
</span><span class="lines">@@ -373,21 +382,12 @@
</span><span class="cx">                         'l10n_print_after' =&gt; 'try{convertEntities(wordCountL10n);}catch(e){};'
</span><span class="cx">                 ));
</span><span class="cx"> 
</span><del>-                $scripts-&gt;add( 'theme', &quot;/wp-admin/js/theme$suffix.js&quot;, array( 'thickbox', 'jquery' ), '20101123' );
</del><ins>+                $scripts-&gt;add( 'theme', &quot;/wp-admin/js/theme$suffix.js&quot;, array( 'thickbox', 'list-table' ), '20101123' );
</ins><span class="cx">                 $scripts-&gt;add_data( 'theme', 'group', 1 );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'theme-preview', &quot;/wp-admin/js/theme-preview$suffix.js&quot;, array( 'thickbox', 'jquery' ), '20100407' );
</span><span class="cx">                 $scripts-&gt;add_data( 'theme-preview', 'group', 1 );
</span><span class="cx"> 
</span><del>-                $scripts-&gt;add( 'list-table', &quot;/wp-admin/js/list-table$suffix.js&quot;, array( 'jquery-query', 'jquery-serialize-object' ), '20101121' );
-                $scripts-&gt;add_data( 'list-table', 'group', 1 );
-                $scripts-&gt;localize( 'list-table', 'listTableL10n', array(
-                        'loading' =&gt; __('Loading...'),
-                        'error' =&gt; __('An error has occurred while loading the items.'),
-                        'search' =&gt; __('Search results for &amp;#8220;%s&amp;#8221;'),
-                        'l10n_print_after' =&gt; 'try{convertEntities(listTableL10n);}catch(e){};'
-                ) );
-
</del><span class="cx">                 $scripts-&gt;add( 'inline-edit-post', &quot;/wp-admin/js/inline-edit-post$suffix.js&quot;, array( 'jquery', 'suggest' ), '20100707' );
</span><span class="cx">                 $scripts-&gt;add_data( 'inline-edit-post', 'group', 1 );
</span><span class="cx">                 $scripts-&gt;localize( 'inline-edit-post', 'inlineEditL10n', array(
</span></span></pre>
</div>
</div>

</body>
</html>