Fix edit link form categories a bit. AJAX add still needs work.
git-svn-id: http://svn.automattic.com/wordpress/trunk@6713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d42b1a8256
commit
45ebbd5bb8
|
@ -210,7 +210,7 @@ else
|
|||
|
||||
<div id="categories-pop" class="ui-tabs-panel" style="display: none;">
|
||||
<ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
|
||||
<?php wp_popular_categories_checklist(); ?>
|
||||
<?php wp_popular_terms_checklist('category'); ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -70,9 +70,8 @@ function xfn_check($class, $value = '', $deprecated = '') {
|
|||
|
||||
<div id="category-adder" class="wp-hidden-children">
|
||||
<h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
|
||||
<p id="category-add" class="wp-hidden-child">
|
||||
<p id="link-category-add" class="wp-hidden-child">
|
||||
<input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" />
|
||||
<?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category') ) ); ?>
|
||||
<input type="button" id="category-add-sumbit" class="add:categorychecklist:linkcategorydiv button" value="<?php _e( 'Add' ); ?>" />
|
||||
<?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
|
||||
<span id="category-ajax-response"></span>
|
||||
|
@ -92,7 +91,7 @@ function xfn_check($class, $value = '', $deprecated = '') {
|
|||
|
||||
<div id="categories-pop" class="ui-tabs-panel" style="display: none;">
|
||||
<ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
|
||||
<?php wp_popular_categories_checklist(); ?>
|
||||
<?php wp_popular_terms_checklist('link_category'); ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -187,8 +187,8 @@ function dropdown_categories( $default = 0, $parent = 0 ) {
|
|||
write_nested_categories( get_nested_categories( $default, $parent ) );
|
||||
}
|
||||
|
||||
function wp_popular_categories_checklist( $default = 0, $number = 10 ) {
|
||||
$categories = get_categories( array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number ) );
|
||||
function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10 ) {
|
||||
$categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number ) );
|
||||
|
||||
foreach ( (array) $categories as $category ) {
|
||||
$id = "popular-category-$category->term_id";
|
||||
|
|
|
@ -8,8 +8,6 @@ addLoadEvent( function() {
|
|||
// Ajax Cat
|
||||
var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } );
|
||||
jQuery('#category-add-sumbit').click( function() { newCat.focus(); } );
|
||||
var newCatParent = false;
|
||||
var newCatParentOption = false;
|
||||
var noSyncChecks = false; // prophylactic. necessary?
|
||||
var syncChecks = function() {
|
||||
if ( noSyncChecks )
|
||||
|
@ -22,8 +20,6 @@ addLoadEvent( function() {
|
|||
noSyncChecks = false;
|
||||
};
|
||||
var catAddAfter = function( r, s ) {
|
||||
if ( !newCatParent ) newCatParent = jQuery('#newcat_parent');
|
||||
if ( !newCatParentOption ) newCatParentOption = newCatParent.find( 'option[value=-1]' );
|
||||
jQuery(s.what + ' response_data', r).each( function() {
|
||||
var t = jQuery(jQuery(this).text());
|
||||
t.find( 'label' ).each( function() {
|
||||
|
@ -31,13 +27,9 @@ addLoadEvent( function() {
|
|||
var val = th.find('input').val();
|
||||
var id = th.find('input')[0].id
|
||||
jQuery('#' + id).change( syncChecks );
|
||||
if ( newCatParent.find( 'option[value=' + val + ']' ).size() )
|
||||
return;
|
||||
var name = jQuery.trim( th.text() );
|
||||
var o = jQuery( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name );
|
||||
newCatParent.prepend( o );
|
||||
} );
|
||||
newCatParentOption.attr( 'selected', true );
|
||||
} );
|
||||
};
|
||||
jQuery('#categorychecklist').wpList( {
|
||||
|
|
|
@ -5,7 +5,7 @@ function add_postbox_toggles() {
|
|||
|
||||
function save_postboxes_state() {
|
||||
var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
|
||||
jQuery.post(postL10n.requestFile, {
|
||||
jQuery.post(postboxL10n.requestFile, {
|
||||
action: 'closed-postboxes',
|
||||
closed: closed,
|
||||
cookie: document.cookie});
|
||||
|
|
|
@ -1365,6 +1365,30 @@ ul.categorychecklist li {
|
|||
padding: 0;
|
||||
}
|
||||
|
||||
#linkcategorydiv #category-adder {
|
||||
margin-left: 120px;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
#linkcategorydiv ul#category-tabs {
|
||||
float: left;
|
||||
width: 120px;
|
||||
text-align: right;
|
||||
/* Negative margin for the sake of those without JS: all tabs display */
|
||||
margin: 0 -120px 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#linkcategorydiv ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#linkcategorydiv ul.categorychecklist ul {
|
||||
margin-left: 18px;
|
||||
}
|
||||
|
||||
/* Global classes */
|
||||
.wp-hidden-children .wp-hidden-child { display: none; }
|
||||
.wp-no-js-hidden { display: none; }
|
||||
|
|
|
@ -132,6 +132,9 @@ class WP_Scripts {
|
|||
$this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
|
||||
$this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
|
||||
$this->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery'), '20080128' );
|
||||
$this->localize( 'postbox', 'postboxL10n', array(
|
||||
'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
|
||||
) );
|
||||
$this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox'), '20080128' );
|
||||
$this->localize( 'post', 'postL10n', array(
|
||||
'tagsUsed' => __('Tags used on this post:'),
|
||||
|
|
Loading…
Reference in New Issue