Fill edit slug box with current slug. Props johnbillion and nbachiyski. fixes #5704
git-svn-id: https://develop.svn.wordpress.org/trunk@6674 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
38cd681725
commit
53ab4b8faa
@ -66,6 +66,7 @@ function save_postboxes_state() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function edit_permalink(post_id) {
|
function edit_permalink(post_id) {
|
||||||
|
var i, c = 0;
|
||||||
var e = jQuery('#editable-post-name');
|
var e = jQuery('#editable-post-name');
|
||||||
var revert_e = e.html();
|
var revert_e = e.html();
|
||||||
var real_slug = jQuery('#post_name');
|
var real_slug = jQuery('#post_name');
|
||||||
@ -84,6 +85,7 @@ function edit_permalink(post_id) {
|
|||||||
jQuery('#sample-permalink').html(data);
|
jQuery('#sample-permalink').html(data);
|
||||||
b.html(revert_b);
|
b.html(revert_b);
|
||||||
real_slug.attr('value', new_slug);
|
real_slug.attr('value', new_slug);
|
||||||
|
make_slugedit_clickable();
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -93,7 +95,11 @@ function edit_permalink(post_id) {
|
|||||||
real_slug.attr('value', revert_e);
|
real_slug.attr('value', revert_e);
|
||||||
return false;
|
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;
|
var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
|
||||||
// on enter, just save the new slug, don't save the post
|
// on enter, just save the new slug, don't save the post
|
||||||
if (13 == key) {b.children('.save').click();return false;}
|
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();
|
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() {
|
addLoadEvent( function() {
|
||||||
jQuery('#tags-input').hide();
|
jQuery('#tags-input').hide();
|
||||||
tag_update_quickclicks();
|
tag_update_quickclicks();
|
||||||
@ -173,5 +183,5 @@ addLoadEvent( function() {
|
|||||||
} );
|
} );
|
||||||
jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
|
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( 'admin-forms', '/wp-admin/js/forms.js', array('wp-lists'), '20080108' );
|
||||||
$this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
|
$this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
|
||||||
$this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
|
$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(
|
$this->localize( 'post', 'postL10n', array(
|
||||||
'tagsUsed' => __('Tags used on this post:'),
|
'tagsUsed' => __('Tags used on this post:'),
|
||||||
'add' => attribute_escape(__('Add')),
|
'add' => attribute_escape(__('Add')),
|
||||||
|
Loading…
Reference in New Issue
Block a user