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

git-svn-id: https://develop.svn.wordpress.org/trunk@16553 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
scribu
2010-11-23 20:17:22 +00:00
parent 81e04a887e
commit 9729c26b07
4 changed files with 33 additions and 18 deletions

View File

@@ -4,7 +4,7 @@ var ThemeViewer;
ThemeViewer = function( args ) {
function filter_count() {
var count = $( '#filters :checked' ).length;
var count = $( '#filter-box :checked' ).length;
var text = $( '#filter-click' ).text();
if ( text.indexOf( '(' ) != -1 )
@@ -19,14 +19,29 @@ var ThemeViewer;
function init() {
$( '#filter-click, #mini-filter-click' ).unbind( 'click' ).click( function() {
$( '#filter-click' ).toggleClass( 'current' );
$( '#filters' ).slideToggle();
$( '#filter-box' ).slideToggle();
$( '#current-theme' ).slideToggle( 300 );
return false;
});
$( '#filters :checkbox' ).unbind( 'click' ).click( function() {
$( '#filter-box :checkbox' ).unbind( 'click' ).click( function() {
filter_count();
});
$('#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;
});
}
// These are the functions we expose