Hide slug box by default. Allow turning it on via screen options. fixes #8332

git-svn-id: http://svn.automattic.com/wordpress/trunk@9956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-11-28 22:35:01 +00:00
parent b52b176111
commit bc8627c841
5 changed files with 19 additions and 11 deletions

View File

@ -434,7 +434,7 @@ wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
</table> </table>
<p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/loading.gif" alt="" /></p> <p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/loading.gif" alt="" /></p>
<?php <?php
$hidden = (array) get_user_option( "meta-box-hidden_post", 0, false ); $hidden = get_hidden_meta_boxes('post');
if ( ! in_array('commentstatusdiv', $hidden) ) { ?> if ( ! in_array('commentstatusdiv', $hidden) ) { ?>
<script type="text/javascript">commentsBox.get(<?php echo $total; ?>, 10);</script> <script type="text/javascript">commentsBox.get(<?php echo $total; ?>, 10);</script>
<?php <?php

View File

@ -2718,7 +2718,7 @@ function do_meta_boxes($page, $context, $object) {
//do_action('do_meta_boxes', $page, $context, $object); //do_action('do_meta_boxes', $page, $context, $object);
$hidden = (array) get_user_option( "meta-box-hidden_$page", 0, false ); $hidden = get_hidden_meta_boxes($page);
echo "<div id='$context-sortables' class='meta-box-sortables'>\n"; echo "<div id='$context-sortables' class='meta-box-sortables'>\n";
@ -2798,7 +2798,7 @@ function meta_box_prefs($page) {
if ( empty($wp_meta_boxes[$page]) ) if ( empty($wp_meta_boxes[$page]) )
return; return;
$hidden = (array) get_user_option( "meta-box-hidden_$page", 0, false ); $hidden = get_hidden_meta_boxes($page);
foreach ( array_keys($wp_meta_boxes[$page]) as $context ) { foreach ( array_keys($wp_meta_boxes[$page]) as $context ) {
foreach ( array_keys($wp_meta_boxes[$page][$context]) as $priority ) { foreach ( array_keys($wp_meta_boxes[$page][$context]) as $priority ) {
@ -2817,6 +2817,20 @@ function meta_box_prefs($page) {
} }
} }
function get_hidden_meta_boxes($page) {
$hidden = (array) get_user_option( "meta-box-hidden_$page", 0, false );
// Hide slug boxes by default
if ( empty($hidden[0]) ) {
if ( 'page' == $page )
$hidden = array('pageslugdiv');
elseif ( 'post' == $page )
$hidden = array('slugdiv');
}
return $hidden;
}
/** /**
* Add a new section to a settings page. * Add a new section to a settings page.
* *

View File

@ -7,9 +7,6 @@ jQuery(document).ready( function($) {
jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } ); jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );
// hide advanced slug field
jQuery('#pageslugdiv').hide();
var stamp = $('#timestamp').html(); var stamp = $('#timestamp').html();
var visibility = $('#post-visibility-display').html(); var visibility = $('#post-visibility-display').html();

View File

@ -107,9 +107,6 @@ jQuery(document).ready( function($) {
// Editable slugs // Editable slugs
make_slugedit_clickable(); make_slugedit_clickable();
// hide advanced slug field
jQuery('#slugdiv').hide();
jQuery('#tags-input').hide(); jQuery('#tags-input').hide();
tag_update_quickclicks(); tag_update_quickclicks();
// add the quickadd form // add the quickadd form

View File

@ -173,7 +173,7 @@ function wp_default_scripts( &$scripts ) {
'save' => __('Save'), 'save' => __('Save'),
'cancel' => __('Cancel') 'cancel' => __('Cancel')
) ); ) );
$scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20081112b' ); $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20081128' );
$scripts->localize( 'post', 'postL10n', array( $scripts->localize( 'post', 'postL10n', array(
'tagsUsed' => __('Tags used on this post:'), 'tagsUsed' => __('Tags used on this post:'),
'add' => attribute_escape(__('Add')), 'add' => attribute_escape(__('Add')),
@ -198,7 +198,7 @@ function wp_default_scripts( &$scripts ) {
'privatelyPublished' => __('Privately Published'), 'privatelyPublished' => __('Privately Published'),
'published' => __('Published') 'published' => __('Published')
) ); ) );
$scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'wp-lists', 'postbox'), '20081112' ); $scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'wp-lists', 'postbox'), '20081128' );
$scripts->localize( 'page', 'postL10n', array( $scripts->localize( 'page', 'postL10n', array(
'cancel' => __('Cancel'), 'cancel' => __('Cancel'),
'edit' => __('Edit'), 'edit' => __('Edit'),