Make WordPress Core

Changeset 6591


Ignore:
Timestamp:
01/10/2008 08:19:58 PM (16 years ago)
Author:
ryan
Message:

Fixes for new categories interface from mdawaffe. fixes #5618

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r6588 r6591  
    174174            continue;
    175175        $category = get_category( $cat_id );
    176         $category->_is_checked = true;
     176        $checked_categories[] = $cat_id;
    177177        ob_start();
    178178            dropdown_categories( 0, $category );
  • trunk/wp-admin/edit-form-advanced.php

    r6588 r6591  
    126126    <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
    127127    <p id="category-add" class="wp-hidden-child">
    128         <input type="text" name="newcat" id="newcat" class="form-required" value="<?php _e( 'New category name' ); ?>" />
     128        <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" />
    129129        <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category') ) ); ?>
    130130        <a id="category-add-sumbit" class="add:categorychecklist:categorydiv button" href="<?php echo wp_nonce_url( '', 'add-category' ); ?>"><?php _e( 'Add' ); ?></a>
  • trunk/wp-admin/includes/template.php

    r6588 r6591  
    145145            'children' => get_nested_categories( $default, $parent->term_id ),
    146146            'cat_ID' => $parent->term_id,
    147             'checked' => isset($parent->_is_checked) && $parent->_is_checked,
     147            'checked' => in_array( $parent->term_id, $checked_categories ),
    148148            'cat_name' => get_the_category_by_ID( $parent->term_id )
    149149        );
  • trunk/wp-admin/js/post.js

    r6588 r6591  
    7070    tag_update_quickclicks();
    7171    // add the quickadd form
    72     jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="button" class="button" id="tagadd" value="' + postL10n.add + '"/><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>');
     72    jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="button" class="button" id="tagadd" value="' + postL10n.add + '"/><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>');
    7373    jQuery('#tagadd').click( tag_flush_to_text );
    7474//  jQuery('#newtag').keydown( tag_press_key );
    7575    jQuery('#newtag').focus(function() {
    76         if ( this.value == postL10n.addTag ) {
    77             this.value = '';
    78             this.style.color = '#333';
    79         }
     76        if ( this.value == postL10n.addTag )
     77            jQuery(this).val( '' ).removeClass( 'form-input-tip' );
    8078    });
    8179    jQuery('#newtag').blur(function() {
    82         if ( this.value == '' ) {
    83             this.value = postL10n.addTag;
    84             this.style.color = '#999'
    85         }
     80        if ( this.value == '' )
     81            jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
    8682    });
    8783
     
    9692
    9793    // Ajax Cat
    98     var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ) } );
     94    var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } );
    9995    jQuery('#category-add-sumbit').click( function() { newCat.focus(); } );
     96    var newCatParent = false;
     97    var newCatParentOption = false;
    10098    var catAddAfter = function( r, s ) {
     99        if ( !newCatParent ) newCatParent = jQuery('#newcat_parent');
     100        if ( !newCatParentOption ) newCatParentOption = newCatParent.find( 'option[value=-1]' );
    101101        jQuery(s.what + ' response_data', r).each( function() {
    102102            var t = jQuery(jQuery(this).text());
    103             var o = jQuery( '<option value="' +  parseInt( t.find(':input').val(), 10 ) + '"></option>' );
    104             o.text( jQuery.trim( t.text() ) );
    105             jQuery('#newcat_parent').prepend( o );
     103            t.find( 'label' ).each( function() {
     104                var th = jQuery(this);
     105                var id = th.find('input').val();
     106                if ( newCatParent.find( 'option[value=' + id + ']' ).size() )
     107                    return;
     108                var name = jQuery.trim( th.text() );
     109                var o = jQuery( '<option value="' +  parseInt( id, 10 ) + '"></option>' ).text( name );
     110                newCatParent.prepend( o );
     111                newCatParentOption.attr( 'selected', true );
     112            } );
    106113        } );
    107114    };
  • trunk/wp-admin/wp-admin.css

    r6588 r6591  
    10891089#tagchecklist span a:hover {
    10901090    background: url(images/xit.gif) no-repeat -10px 0;
    1091 }
    1092 
    1093 #newtag {
    1094     color: #999;
    10951091}
    10961092
     
    12851281.wp-hidden-children .wp-hidden-child { display: none; }
    12861282.ui-tabs-hide { display: none; }
     1283.form-input-tip { color: #999; }
  • trunk/wp-includes/js/wp-lists.js

    r6588 r6591  
    268268        e = $(e);
    269269
    270         var old = false; var next = false;
     270        var old = false;
    271271        var _s = { pos: 0, id: 0, oldId: null };
    272272        if ( 'string' == typeof s ) { s = { what: s }; }
     
    274274
    275275        if ( !e.size() || !s.what ) { return false; }
    276         if ( s.oldId ) {
    277             old = $('#' + s.what + '-' + s.oldId);
    278             next = old.next();
    279             old.remove();
    280         }
    281         if ( s.id ) { $('#' + s.what + '-' + s.id).remove(); }
     276        if ( s.oldId ) { old = $('#' + s.what + '-' + s.oldId); }
     277        if ( s.id && ( s.id != s.oldId || !old || !old.size() ) ) { $('#' + s.what + '-' + s.id).remove(); }
    282278
    283279        if ( old && old.size() ) {
    284             if ( next && next.size() ) {
    285                 next.before(e);
    286             } else {
    287                 list.append(e);
    288             }
     280            old.replaceWith(e);
    289281        } else if ( isNaN(s.pos) ) {
    290282            var ba = 'after';
     
    332324    process: function(el) {
    333325        var list = this;
    334         var bl = function() { currentFormEl = false; };
    335         var fo = function() { currentFormEl = this; };
    336326        var a = $("[@class^=add:" + list.id + ":]", el || null)
    337327            .filter('form').submit( function() { return list.wpList.add(this); } ).end()
     
    341331                if ( !c ) { return; }
    342332                var forms = []; var ins = [];
    343                 $('#' + c + ' :input').click( function() { $(this).unbind( 'blur', bl ).unbind( 'focus', fo ).blur( bl ).focus( fo ).focus(); } ).each( function() {
     333                $('#' + c + ' :input').focus( function() { currentFormEl = this; } ).blur( function() { currentFormEl = false; } ).each( function() {
    344334                    ins.push(this);
    345335                    $.merge(forms,$(this).parents('form'));
     
    347337                } );
    348338                $(forms).submit( function() {
    349                     var e = currentFormEl;
    350                     if ( 0 <= $.inArray(e,ins) ) {
     339                    if ( 0 <= $.inArray(currentFormEl,ins) ) {
    351340                        $(addEl).trigger( 'click' );
    352                         $(e).focus();
     341                        $(currentFormEl).focus();
    353342                        return false;
    354343                    }
  • trunk/wp-includes/script-loader.php

    r6588 r6591  
    6161        ) );
    6262
    63         $this->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('jquery'), '20080109' );
     63        $this->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('jquery'), '20080110' );
    6464        $this->localize( 'wp-lists', 'wpListL10n', array(
    6565            'url' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php'
     
    109109            $this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
    110110            $this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
    111             $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists'), '20080109' );
     111            $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists'), '20080110' );
    112112            $this->localize( 'post', 'postL10n', array(
    113113                'tagsUsed' =>  __('Tags used on this post:'),
Note: See TracChangeset for help on using the changeset viewer.