Media Grid: Screen Options for grid have to play nice with Screen Options for list. This was fun.

See #24716.

Built from https://develop.svn.wordpress.org/trunk@29078


git-svn-id: http://core.svn.wordpress.org/trunk@28864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-07-10 21:26:16 +00:00
parent a89060013b
commit a9fb59151b
4 changed files with 20 additions and 5 deletions

View File

@ -1078,7 +1078,13 @@ final class WP_Screen {
</div>
<?php elseif ( $this->get_option( 'media_grid_title' ) ): ?>
<div class="metabox-prefs media-grid-prefs">
<?php foreach ( $this->_options as $column => $args ) {
<?php
$option = get_user_option( 'manageuploadgridcolumnshidden' );
$hidden = array();
if ( ! empty( $option ) ) {
$hidden = $option;
}
foreach ( $this->_options as $column => $args ) {
$id = "$column-hide";
echo '<label for="' . $id . '">';
$saved = str_replace( 'media_grid_', '', $column );

View File

@ -27,7 +27,7 @@ columns = {
},
saveManageColumnsState : function() {
var hidden = this.hidden();
var hidden, page;
if ( $( '#media_grid_title-hide' ).length ) {
hidden = [];
$( '.hide-column-tog', '.media-grid-prefs' ).each( function() {
@ -40,13 +40,18 @@ columns = {
$el.removeClass( 'data-hidden' ).addClass( 'data-visible' );
}
} );
page = pagenow + 'grid';
hidden = hidden.join( ',' );
} else {
page = pagenow;
hidden = this.hidden();
}
$.post(ajaxurl, {
action: 'hidden-columns',
hidden: hidden,
screenoptionnonce: $('#screenoptionnonce').val(),
page: pagenow
page: page
});
},

File diff suppressed because one or more lines are too long

View File

@ -419,7 +419,11 @@ function wp_print_media_templates() {
if ( _.contains( data.controller.options.mode, 'grid' ) ) { #>
<div class="data-fields">
<?php
$hidden = get_hidden_columns( get_current_screen() );
$option = get_user_option( 'manageuploadgridcolumnshidden' );
$hidden = array();
if ( ! empty( $option ) ) {
$hidden = $option;
}
$fields = array( 'title', 'uploadedTo', 'dateFormatted', 'mime' );
foreach ( $fields as $field ):
$class_name = in_array( $field, $hidden ) ? 'data-field data-hidden' : 'data-field data-visible';