Changeset 22021
- Timestamp:
- 09/26/2012 08:50:13 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ajax-actions.php
r21914 r22021 1803 1803 function wp_ajax_query_attachments() { 1804 1804 $query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array(); 1805 $query = array_intersect_key( $query, array_flip( array( 's', 'order', 'orderby', 'posts_per_page', 'paged' ) ) );1805 $query = array_intersect_key( $query, array_flip( array( 's', 'order', 'orderby', 'posts_per_page', 'paged', 'post_mime_type' ) ) ); 1806 1806 1807 1807 $query['post_type'] = 'attachment'; -
trunk/wp-includes/js/media-models.js
r22013 r22021 225 225 this.props.on( 'change:query', this._changeQuery, this ); 226 226 this.props.on( 'change:search', this._changeSearch, this ); 227 this.props.on( 'change:type', this._changeType, this ); 227 228 228 229 // Set the `props` model and fill the default property values. … … 265 266 }, 266 267 267 _change Search: function(model, term ) {268 _changeFilteredProp: function( prop, model, term ) { 268 269 // Bail if we're currently searching for the same term. 269 if ( this.props.get( 'search') === term )270 if ( this.props.get( prop ) === term ) 270 271 return; 271 272 272 if ( term && ! this.filters .search)273 this.filters .search = Attachments.filters.search;274 else if ( ! term && this.filters .search === Attachments.filters.search)275 delete this.filters .search;273 if ( term && ! this.filters[ prop ] ) 274 this.filters[ prop ] = Attachments.filters[ prop ]; 275 else if ( ! term && this.filters[ prop ] === Attachments.filters[ prop ] ) 276 delete this.filters[ prop ]; 276 277 277 278 // If no `Attachments` model is provided to source the searches … … 282 283 283 284 this.reset( this.props.get('source').filter( this.validator ) ); 285 }, 286 287 _changeSearch: function( model, term ) { 288 return this._changeFilteredProp( 'search', model, term ); 289 }, 290 291 _changeType: function( model, term ) { 292 return this._changeFilteredProp( 'type', model, term ); 284 293 }, 285 294 … … 381 390 return value && -1 !== value.search( this.props.get('search') ); 382 391 }, this ); 392 }, 393 394 type: function( attachment ) { 395 var type = this.props.get('type'); 396 if ( ! type ) 397 return true; 398 399 return -1 !== type.indexOf( attachment.get('type') ); 383 400 } 384 401 } … … 498 515 499 516 propmap: { 500 'search': 's' 517 'search': 's', 518 'type': 'post_mime_type' 501 519 }, 502 520
Note: See TracChangeset
for help on using the changeset viewer.