Show the current post format in quick edit even if it's not supported. Props nacin, fixes #18083.

git-svn-id: https://develop.svn.wordpress.org/trunk@19011 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jon Cave 2011-10-19 17:48:07 +00:00
parent f32a070480
commit d7ee58c7e2
3 changed files with 17 additions and 6 deletions

View File

@ -998,18 +998,21 @@ class WP_Posts_List_Table extends WP_List_Table {
<?php if ( post_type_supports( $screen->post_type, 'post-formats' ) && current_theme_supports( 'post-formats' ) ) :
$post_formats = get_theme_support( 'post-formats' );
if ( is_array( $post_formats[0] ) ) : ?>
if ( isset( $post_formats[0] ) && is_array( $post_formats[0] ) ) :
$all_post_formats = get_post_format_strings(); ?>
<div class="inline-edit-group">
<label class="alignleft" for="post_format">
<span class="title"><?php _e( 'Post Format' ); ?></span>
<select name="post_format" id="post_format">
<select name="post_format">
<?php if ( $bulk ) : ?>
<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
<?php endif; ?>
<option value="0"><?php _ex( 'Standard', 'Post format' ); ?></option>
<?php foreach ( $post_formats[0] as $format ): ?>
<option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option>
<?php endforeach; ?>
<?php foreach ( $all_post_formats as $slug => $format ):
if ( $slug != 'standard' ) : ?>
<option value="<?php echo esc_attr( $slug ); ?>"<?php if ( ! in_array( $slug, $post_formats[0] ) ) echo ' class="unsupported"'; ?>><?php echo esc_html( $format ); ?></option>
<?php endif;
endforeach; ?>
</select></label>
</div>
<?php endif; ?>

View File

@ -151,6 +151,14 @@ inlineEditPost = {
$('label.inline-edit-author', editRow).hide();
}
// hide unsupported formats, but leave the current format alone
var cur_format = $('.post_format', rowData).text();
$('option.unsupported', editRow).each(function() {
var $this = $(this);
if ( $this.val() != cur_format )
$this.remove();
});
for ( var f = 0; f < fields.length; f++ ) {
$(':input[name="' + fields[f] + '"]', editRow).val( $('.'+fields[f], rowData).text() );
}

File diff suppressed because one or more lines are too long