Ajaxify theme feature filter. Props ocean90 for initial patch. See #14936
git-svn-id: http://svn.automattic.com/wordpress/trunk@16553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3230b44f63
commit
c891b0ebc7
|
@ -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
|
||||
|
|
|
@ -1 +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()});
|
||||
var 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()});
|
|
@ -129,7 +129,7 @@ if ( ! current_user_can( 'switch_themes' ) ) {
|
|||
?>
|
||||
<h3><?php _e('Available Themes'); ?></h3>
|
||||
|
||||
<form class="search-form" action="" method="get">
|
||||
<form class="search-form filter-form" action="" method="get">
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="theme-search-input"><?php _e('Search Themes'); ?>:</label>
|
||||
<input type="text" id="theme-search-input" name="s" value="<?php _admin_search_query(); ?>" />
|
||||
|
@ -139,7 +139,7 @@ if ( ! current_user_can( 'switch_themes' ) ) {
|
|||
|
||||
<br class="clear"/>
|
||||
|
||||
<div id="filters" style="display: none;">
|
||||
<div id="filter-box" style="display: none;">
|
||||
<?php $feature_list = get_theme_feature_list(); ?>
|
||||
<div class="feature-filter">
|
||||
<p class="install-help"><?php _e('Theme filters') ?></p>
|
||||
|
@ -154,10 +154,10 @@ if ( ! current_user_can( 'switch_themes' ) ) {
|
|||
<?php foreach ( $features as $key => $feature ) :
|
||||
$feature_name = $feature;
|
||||
$feature_name = esc_html( $feature_name );
|
||||
$feature = esc_attr($feature);
|
||||
$feature = esc_attr( $feature );
|
||||
?>
|
||||
<li>
|
||||
<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 ) ); ?>/>
|
||||
<input type="checkbox" name="features[]" id="feature-id-<?php echo $key; ?>" value="<?php echo $key; ?>" <?php checked( in_array( $key, $wp_list_table->features ) ); ?>/>
|
||||
<label for="feature-id-<?php echo $key; ?>"><?php echo $feature_name; ?></label>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
@ -304,6 +304,15 @@ function wp_default_scripts( &$scripts ) {
|
|||
$scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
|
||||
$scripts->add_data( 'admin-custom-fields', 'group', 1 );
|
||||
|
||||
$scripts->add( 'list-table', "/wp-admin/js/list-table$suffix.js", array( 'jquery-query', 'jquery-serialize-object' ), '20101121' );
|
||||
$scripts->add_data( 'list-table', 'group', 1 );
|
||||
$scripts->localize( 'list-table', 'listTableL10n', array(
|
||||
'loading' => __('Loading...'),
|
||||
'error' => __('An error has occurred while loading the items.'),
|
||||
'search' => __('Search results for “%s”'),
|
||||
'l10n_print_after' => 'try{convertEntities(listTableL10n);}catch(e){};'
|
||||
) );
|
||||
|
||||
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'list-table', 'jquery-ui-resizable', 'quicktags'), '20101121' );
|
||||
$scripts->add_data( 'admin-comments', 'group', 1 );
|
||||
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
||||
|
@ -373,21 +382,12 @@ function wp_default_scripts( &$scripts ) {
|
|||
'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};'
|
||||
));
|
||||
|
||||
$scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'thickbox', 'jquery' ), '20101123' );
|
||||
$scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'thickbox', 'list-table' ), '20101123' );
|
||||
$scripts->add_data( 'theme', 'group', 1 );
|
||||
|
||||
$scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20100407' );
|
||||
$scripts->add_data( 'theme-preview', 'group', 1 );
|
||||
|
||||
$scripts->add( 'list-table', "/wp-admin/js/list-table$suffix.js", array( 'jquery-query', 'jquery-serialize-object' ), '20101121' );
|
||||
$scripts->add_data( 'list-table', 'group', 1 );
|
||||
$scripts->localize( 'list-table', 'listTableL10n', array(
|
||||
'loading' => __('Loading...'),
|
||||
'error' => __('An error has occurred while loading the items.'),
|
||||
'search' => __('Search results for “%s”'),
|
||||
'l10n_print_after' => 'try{convertEntities(listTableL10n);}catch(e){};'
|
||||
) );
|
||||
|
||||
$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), '20100707' );
|
||||
$scripts->add_data( 'inline-edit-post', 'group', 1 );
|
||||
$scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
|
||||
|
|
Loading…
Reference in New Issue