WordPress.org

Make WordPress Core

Changeset 6954


Ignore:
Timestamp:
02/21/08 17:08:06 (7 years ago)
Author:
ryan
Message:

Show permalink editor on new posts after autosave. Props filosofo. see #5749

Location:
trunk
Files:
6 edited

Legend:

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

    r6953 r6954  
    528528    check_ajax_referer( 'getpermalink', 'getpermalinknonce' ); 
    529529    $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0; 
    530     die(get_permalink($post_id)); 
     530    die(add_query_arg(array('preview' => 'true'), get_permalink($post_id))); 
    531531break; 
    532532case 'sample-permalink': 
  • trunk/wp-admin/edit-form-advanced.php

    r6953 r6954  
    7272<div class="inside"> 
    7373    <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape($post->post_title); ?>" id="title" /> 
    74 <?php 
    75     $sample_permalink_html = get_sample_permalink_html($post->ID); 
    76     if ($post->ID && $sample_permalink_html): 
    77 ?> 
    78     <div id="edit-slug-box" style="display: <?php echo $post->ID? 'block' : 'none';?>"> 
    79         <strong><?php _e('Permalink:'); ?></strong> 
    80         <span id="sample-permalink"><?php echo $sample_permalink_html; ?></span> 
    81         <span id="edit-slug-buttons"><a href="#post_name" class="edit-slug" onclick="edit_permalink(<?php echo $post->ID; ?>);return false;"><?php _e('Edit');?></a></span> 
     74<?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?> 
     75    <div id="edit-slug-box"> 
     76<?php if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :  
     77    echo $sample_permalink_html; 
     78endif; ?> 
    8279    </div> 
    83 <?php 
    84     endif; 
    85     ?> 
    8680</div> 
    8781</div> 
  • trunk/wp-admin/includes/post.php

    r6910 r6954  
    605605    $post_name_html = '<span id="editable-post-name" title="'.$title.'">'.$post_name_abridged.'</span><span id="editable-post-name-full">'.$post_name.'</span>'; 
    606606    $display_link = str_replace('%postname%', $post_name_html, $permalink); 
    607     return $display_link; 
     607    $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $display_link . "</span>\n"; 
     608    $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug" onclick="edit_permalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n"; 
     609    return $return; 
    608610} 
    609611 
  • trunk/wp-admin/js/slug.js

    r6794 r6954  
    1717            new_slug: new_slug, 
    1818            samplepermalinknonce: jQuery('#samplepermalinknonce').val()}, function(data) { 
    19                 jQuery('#sample-permalink').html(data); 
     19                jQuery('#edit-slug-box').html(data); 
    2020                b.html(revert_b); 
    2121                real_slug.attr('value', new_slug);   
  • trunk/wp-includes/js/autosave.js

    r6953 r6954  
    4848    jQuery('#autosave').html(message); 
    4949    autosave_update_preview_link(res); 
     50    autosave_update_slug(res); 
    5051    autosave_enable_buttons(); 
    5152} 
     
    6364            jQuery('#previewview').html('<a target="_blank" href="'+permalink+'">'+previewText+'</a>'); 
    6465        }); 
    65          
     66    } 
     67} 
     68 
     69function autosave_update_slug(post_id) { 
     70    // create slug area only if not already there 
     71    if ( 'undefined' != typeof make_slugedit_clickable && ! jQuery('#edit-slug-box > *').get()[0] ) { 
     72        jQuery.post(slugL10n.requestFile, { 
     73            action: 'sample-permalink', 
     74            post_id: post_id, 
     75            samplepermalinknonce: jQuery('#samplepermalinknonce').val()}, function(data) { 
     76                jQuery('#edit-slug-box').html(data); 
     77                make_slugedit_clickable(); 
     78            }); 
    6679    } 
    6780} 
     
    8295    jQuery('#autosave').html(message); 
    8396    autosave_update_preview_link(res); 
     97    autosave_update_slug(res); 
    8498    autosave_enable_buttons(); 
    8599} 
  • trunk/wp-includes/script-loader.php

    r6953 r6954  
    4343        $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6'); 
    4444 
    45         $this->add( 'autosave', '/wp-includes/js/autosave.js', array('jquery', 'schedule'), '20080220'); 
     45        $this->add( 'autosave', '/wp-includes/js/autosave.js', array('jquery', 'schedule'), '20080221'); 
    4646        $this->localize( 'autosave', 'autosaveL10n', array( 
    4747            'autosaveInterval' => apply_filters('autosave_interval', '120'), 
Note: See TracChangeset for help on using the changeset viewer.