Sync checkboxes only for categories, some white space cleanup, props kevinB, fixes #12244
git-svn-id: http://svn.automattic.com/wordpress/trunk@13195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4f460639c8
commit
4c52731c85
|
@ -253,46 +253,45 @@ jQuery(document).ready( function($) {
|
|||
}
|
||||
|
||||
// categories
|
||||
$('.categorydiv').each(function(){
|
||||
var this_id = $(this).attr('id'), noSyncChecks = false, syncChecks, catAddAfter, popularCats;
|
||||
var taxonomy_parts = this_id.split('-');
|
||||
taxonomy_parts.shift();
|
||||
var taxonomy = taxonomy_parts.join('-');
|
||||
var settingName = taxonomy+'_tab';
|
||||
if(taxonomy == 'category')
|
||||
$('.categorydiv').each( function(){
|
||||
var this_id = $(this).attr('id'), noSyncChecks = false, syncChecks, catAddAfter, taxonomyParts, taxonomy, settingName;
|
||||
|
||||
taxonomyParts = this_id.split('-');
|
||||
taxonomyParts.shift();
|
||||
taxonomy = taxonomyParts.join('-');
|
||||
settingName = taxonomy + '_tab';
|
||||
if ( taxonomy == 'category' )
|
||||
settingName = 'cats';
|
||||
|
||||
// TODO: move to jQuery 1.3+, support for multiple hierarchical taxonomies, see wp-lists.dev.js
|
||||
$('a', '#'+taxonomy+'-tabs').click(function(){
|
||||
$('a', '#' + taxonomy + '-tabs').click( function(){
|
||||
var t = $(this).attr('href');
|
||||
$(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
|
||||
$('#'+taxonomy+'-tabs').siblings('.tabs-panel').hide();
|
||||
$('#' + taxonomy + '-tabs').siblings('.tabs-panel').hide();
|
||||
$(t).show();
|
||||
if ( '#'+taxonomy+'-all' == t )
|
||||
if ( '#' + taxonomy + '-all' == t )
|
||||
deleteUserSetting(settingName);
|
||||
else
|
||||
setUserSetting(settingName,'pop');
|
||||
setUserSetting(settingName, 'pop');
|
||||
return false;
|
||||
});
|
||||
|
||||
if ( getUserSetting(settingName) )
|
||||
$('a[href="#'+taxonomy+'-pop"]', '#'+taxonomy+'-tabs').click();
|
||||
$('a[href="#' + taxonomy + '-pop"]', '#' + taxonomy + '-tabs').click();
|
||||
|
||||
// Ajax Cat
|
||||
$('#new'+taxonomy).one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
|
||||
$('#'+taxonomy+'-add-submit').click(function(){$('#new'+taxonomy).focus();});
|
||||
$('#new' + taxonomy).one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
|
||||
$('#' + taxonomy + '-add-submit').click( function(){ $('#new' + taxonomy).focus(); });
|
||||
|
||||
syncChecks = function() {
|
||||
if ( noSyncChecks )
|
||||
return;
|
||||
noSyncChecks = true;
|
||||
var th = jQuery(this), c = th.is(':checked'), id = th.val().toString();
|
||||
$('#in-'+taxonomy+'-' + id + ', #in-'+taxonomy+'-category-' + id).attr( 'checked', c );
|
||||
$('#in-' + taxonomy + '-' + id + ', #in-' + taxonomy + '-category-' + id).attr( 'checked', c );
|
||||
noSyncChecks = false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
catAddBefore = function( s ) {
|
||||
if ( !$('#new'+taxonomy).val() )
|
||||
return false;
|
||||
|
@ -309,21 +308,23 @@ jQuery(document).ready( function($) {
|
|||
}
|
||||
};
|
||||
|
||||
$('#'+taxonomy+'checklist').wpList({
|
||||
$('#' + taxonomy + 'checklist').wpList({
|
||||
alt: '',
|
||||
response: taxonomy+'-ajax-response',
|
||||
response: taxonomy + '-ajax-response',
|
||||
addBefore: catAddBefore,
|
||||
addAfter: catAddAfter
|
||||
});
|
||||
$('#'+taxonomy+'-add-toggle').click( function() {
|
||||
$('#'+taxonomy+'-adder').toggleClass( 'wp-hidden-children' );
|
||||
$('a[href="#'+taxonomy+'-all"]', '#'+taxonomy+'-tabs').click();
|
||||
|
||||
$('#' + taxonomy + '-add-toggle').click( function() {
|
||||
$('#' + taxonomy + '-adder').toggleClass( 'wp-hidden-children' );
|
||||
$('a[href="#' + taxonomy + '-all"]', '#' + taxonomy + '-tabs').click();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#'+taxonomy+'checklist').children('li.popular-category').add( $('#'+taxonomy+'checklist-pop').children() ).find(':checkbox').live( 'click', function(){
|
||||
$('#' + taxonomy + 'checklist').children('li.popular-category').add( $('#' + taxonomy + 'checklist-pop').children() ).find(':checkbox').live( 'click', function(){
|
||||
var t = $(this), c = t.is(':checked'), id = t.val();
|
||||
$('#in-'+taxonomy+'-' + id + ', #in-popular-'+taxonomy+'-' + id).attr( 'checked', c );
|
||||
if ( id && t.parents('#taxonomy-'+taxonomy).length )
|
||||
$('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).attr( 'checked', c );
|
||||
});
|
||||
|
||||
}); // end cats
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -275,7 +275,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20091012' );
|
||||
$scripts->add_data( 'postbox', 'group', 1 );
|
||||
|
||||
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20091208' );
|
||||
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20100217' );
|
||||
$scripts->add_data( 'post', 'group', 1 );
|
||||
$scripts->localize( 'post', 'postL10n', array(
|
||||
'tagsUsed' => __('Tags used on this post:'),
|
||||
|
|
Loading…
Reference in New Issue