mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 00:01:27 +01:00
Use full slug, not abbreviated slug, when editing. Props nbachiyski. fixes #5816
git-svn-id: http://svn.automattic.com/wordpress/trunk@6794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
081e7089a8
commit
94915febc5
@ -555,11 +555,13 @@ function get_sample_permalink_html($id, $new_slug=null) {
|
||||
if (false === strpos($permalink, '%postname%')) {
|
||||
return '';
|
||||
}
|
||||
$title = __('You can edit this part of the permalink using the Edit button on the right');
|
||||
$title = __('Click to edit this part of the permalink');
|
||||
if (strlen($post_name) > 30) {
|
||||
$post_name = substr($post_name, 0, 14). '…' . substr($post_name, -14);
|
||||
$post_name_abridged = substr($post_name, 0, 14). '…' . substr($post_name, -14);
|
||||
} else {
|
||||
$post_name_abridged = $post_name;
|
||||
}
|
||||
$post_name_html = '<span id="editable-post-name" title="'.$title.'">'.$post_name.'</span>';
|
||||
$post_name_html = '<span id="editable-post-name" title="'.$title.'">'.$post_name_abridged.'</span><span id="editable-post-name-full">'.$post_name.'</span>';
|
||||
$display_link = str_replace('%postname%', $post_name_html, $permalink);
|
||||
return $display_link;
|
||||
}
|
||||
|
@ -3,9 +3,10 @@ function edit_permalink(post_id) {
|
||||
var e = jQuery('#editable-post-name');
|
||||
var revert_e = e.html();
|
||||
var real_slug = jQuery('#post_name');
|
||||
var revert_slug = real_slug.html();
|
||||
var b = jQuery('#edit-slug-buttons');
|
||||
var revert_b = b.html();
|
||||
var old_slug = e.children('span').html();
|
||||
var full = jQuery('#editable-post-name-full').html();
|
||||
|
||||
b.html('<a href="" class="save">'+slugL10n.save+'</a> <a class="cancel" href="">'+slugL10n.cancel+'</a>');
|
||||
b.children('.save').click(function() {
|
||||
@ -25,13 +26,13 @@ function edit_permalink(post_id) {
|
||||
jQuery('#edit-slug-buttons .cancel').click(function() {
|
||||
e.html(revert_e);
|
||||
b.html(revert_b);
|
||||
real_slug.attr('value', revert_e);
|
||||
real_slug.attr('value', revert_slug);
|
||||
return false;
|
||||
});
|
||||
for(i=0; i < revert_e.length; ++i) {
|
||||
if ('%' == revert_e.charAt(i)) c++;
|
||||
for(i=0; i < full.length; ++i) {
|
||||
if ('%' == full.charAt(i)) c++;
|
||||
}
|
||||
slug_value = (c > revert_e.length/4)? '' : revert_e;
|
||||
slug_value = (c > full.length/4)? '' : full;
|
||||
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
|
||||
|
@ -1053,6 +1053,7 @@ html, body {
|
||||
}
|
||||
#edit-slug-box strong {color: #777;}
|
||||
#editable-post-name {background-color: #FFFBCC;}
|
||||
#editable-post-name-full {display: none;}
|
||||
#editable-post-name input {width: 16em;}
|
||||
#edit-slug-buttons a.save {
|
||||
background-color: #ebebeb;
|
||||
|
Loading…
Reference in New Issue
Block a user