Fill edit slug box with current slug. Props johnbillion and nbachiyski. fixes #5704
git-svn-id: http://svn.automattic.com/wordpress/trunk@6674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9cc169608f
commit
8f6920d116
|
@ -66,6 +66,7 @@ function save_postboxes_state() {
|
|||
}
|
||||
|
||||
function edit_permalink(post_id) {
|
||||
var i, c = 0;
|
||||
var e = jQuery('#editable-post-name');
|
||||
var revert_e = e.html();
|
||||
var real_slug = jQuery('#post_name');
|
||||
|
@ -84,6 +85,7 @@ function edit_permalink(post_id) {
|
|||
jQuery('#sample-permalink').html(data);
|
||||
b.html(revert_b);
|
||||
real_slug.attr('value', new_slug);
|
||||
make_slugedit_clickable();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
@ -93,7 +95,11 @@ function edit_permalink(post_id) {
|
|||
real_slug.attr('value', revert_e);
|
||||
return false;
|
||||
});
|
||||
e.html('<input type="text" id="new-post-slug" value="" />').children('input').keypress(function(e){
|
||||
for(i=0; i < revert_e.length; ++i) {
|
||||
if ('%' == revert_e.charAt(i)) c++;
|
||||
}
|
||||
slug_value = (c > revert_e.length/4)? '' : revert_e;
|
||||
e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e){
|
||||
var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
|
||||
// on enter, just save the new slug, don't save the post
|
||||
if (13 == key) {b.children('.save').click();return false;}
|
||||
|
@ -101,6 +107,10 @@ function edit_permalink(post_id) {
|
|||
real_slug.attr('value', this.value)}).focus();
|
||||
}
|
||||
|
||||
function make_slugedit_clickable() {
|
||||
jQuery('#editable-post-name').click(function() {jQuery('#edit-slug-buttons').children('.edit-slug').click()});
|
||||
}
|
||||
|
||||
addLoadEvent( function() {
|
||||
jQuery('#tags-input').hide();
|
||||
tag_update_quickclicks();
|
||||
|
@ -173,5 +183,5 @@ addLoadEvent( function() {
|
|||
} );
|
||||
jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
|
||||
|
||||
jQuery('#editable-post-name').click(function() {jQuery('#edit-slug-buttons').children('.edit-slug').click()});
|
||||
make_slugedit_clickable();
|
||||
});
|
||||
|
|
|
@ -131,7 +131,7 @@ class WP_Scripts {
|
|||
$this->add( 'admin-forms', '/wp-admin/js/forms.js', array('wp-lists'), '20080108' );
|
||||
$this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
|
||||
$this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
|
||||
$this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists'), '20080110' );
|
||||
$this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists'), '20080128' );
|
||||
$this->localize( 'post', 'postL10n', array(
|
||||
'tagsUsed' => __('Tags used on this post:'),
|
||||
'add' => attribute_escape(__('Add')),
|
||||
|
|
Loading…
Reference in New Issue