From 090e465ffd4bbae91c2cef63c1719313c88f73fc Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sat, 2 Feb 2008 20:31:56 +0000 Subject: [PATCH] Fix edit link form categories a bit. AJAX add still needs work. git-svn-id: https://develop.svn.wordpress.org/trunk@6713 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/edit-form-advanced.php | 2 +- wp-admin/edit-link-form.php | 5 ++--- wp-admin/includes/template.php | 4 ++-- wp-admin/js/link.js | 8 -------- wp-admin/js/postbox.js | 2 +- wp-admin/wp-admin.css | 24 ++++++++++++++++++++++++ wp-includes/script-loader.php | 3 +++ 7 files changed, 33 insertions(+), 15 deletions(-) diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 75a1d80d72..5b25ef8547 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -210,7 +210,7 @@ else diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php index 86a7e06a21..39bb566035 100644 --- a/wp-admin/edit-link-form.php +++ b/wp-admin/edit-link-form.php @@ -70,9 +70,8 @@ function xfn_check($class, $value = '', $deprecated = '') {

-

+

diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 4936bd293e..1ea24bb87f 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -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"; diff --git a/wp-admin/js/link.js b/wp-admin/js/link.js index cc7bf84981..ec6d1d1776 100644 --- a/wp-admin/js/link.js +++ b/wp-admin/js/link.js @@ -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( '' ).text( name ); - newCatParent.prepend( o ); } ); - newCatParentOption.attr( 'selected', true ); } ); }; jQuery('#categorychecklist').wpList( { diff --git a/wp-admin/js/postbox.js b/wp-admin/js/postbox.js index ad193e4636..7b05458db7 100644 --- a/wp-admin/js/postbox.js +++ b/wp-admin/js/postbox.js @@ -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}); diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index f16c438b3b..cc4adf5248 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -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; } diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 36874fa05b..7d411841ed 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -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:'),