Make WordPress Core


Ignore:
Timestamp:
02/26/2015 11:00:20 PM (11 years ago)
Author:
wonderboymusic
Message:

Persist search terms across grid/list modes:

  • In grid mode, when the page loads and s is in the URL, all attachments are loaded and then the search value is set, which will filter the attachments. If the page loads with the attachments already filtered, the library will have to be requery'd to get the full set, which will require weirder code.
  • When a user searches, the mode-switcher link for list view is updated dynamically to represent the current location.href in the proper mode= and s= context.

Fixes #30583.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/upload.php

    r31200 r31562  
    2626    wp_enqueue_script( 'media' );
    2727
    28     $vars = wp_edit_attachments_query_vars();
     28    $q = $_GET;
     29    // let JS handle this
     30    unset( $q['s'] );
     31    $vars = wp_edit_attachments_query_vars( $q );
    2932    $ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' );
    3033    foreach ( $vars as $key => $value ) {
     
    6871    require_once( ABSPATH . 'wp-admin/admin-header.php' );
    6972    ?>
    70     <div class="wrap" id="wp-media-grid">
     73    <div class="wrap" id="wp-media-grid" data-search="<?php _admin_search_query() ?>">
    7174        <h2>
    7275        <?php
Note: See TracChangeset for help on using the changeset viewer.