mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Themes: After [36546] restore theme search functionality.
* Correct several incorrect uses of `_.union`. Since Underscore 1.7.0 `_.union` supports only arrays and not variadic args. * Use a namespaced event `themes:update`. Backbone 1.2 added a built in `update` event that triggers after any amount of models are added or removed from a collection. Props adamsilverstein. See #34350. Built from https://develop.svn.wordpress.org/trunk@36580 git-svn-id: http://core.svn.wordpress.org/trunk@36547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
284f88e35a
commit
6f2a56bf3e
@ -158,8 +158,8 @@ themes.Collection = Backbone.Collection.extend({
|
||||
$( 'body' ).removeClass( 'no-results' );
|
||||
}
|
||||
|
||||
// Trigger an 'update' event
|
||||
this.trigger( 'update' );
|
||||
// Trigger a 'themes:update' event
|
||||
this.trigger( 'themes:update' );
|
||||
},
|
||||
|
||||
// Performs a search within the collection
|
||||
@ -185,7 +185,7 @@ themes.Collection = Backbone.Collection.extend({
|
||||
description = data.get( 'description' ).replace( /(<([^>]+)>)/ig, '' );
|
||||
author = data.get( 'author' ).replace( /(<([^>]+)>)/ig, '' );
|
||||
|
||||
haystack = _.union( name, data.get( 'id' ), description, author, data.get( 'tags' ) );
|
||||
haystack = _.union( [ name, data.get( 'id' ), description, author, data.get( 'tags' ) ] );
|
||||
|
||||
if ( match.test( data.get( 'author' ) ) && term.length > 2 ) {
|
||||
data.set( 'displayAuthor', true );
|
||||
@ -264,7 +264,7 @@ themes.Collection = Backbone.Collection.extend({
|
||||
|
||||
// Trigger a collection refresh event
|
||||
// and a `query:success` event with a `count` argument.
|
||||
self.trigger( 'update' );
|
||||
self.trigger( 'themes:update' );
|
||||
self.trigger( 'query:success', count );
|
||||
|
||||
if ( data.themes && data.themes.length === 0 ) {
|
||||
@ -308,7 +308,7 @@ themes.Collection = Backbone.Collection.extend({
|
||||
this.count = this.length;
|
||||
}
|
||||
|
||||
this.trigger( 'update' );
|
||||
this.trigger( 'themes:update' );
|
||||
this.trigger( 'query:success', this.count );
|
||||
}
|
||||
},
|
||||
@ -863,11 +863,11 @@ themes.view.Themes = wp.Backbone.View.extend({
|
||||
self.currentTheme();
|
||||
|
||||
// When the collection is updated by user input...
|
||||
this.listenTo( self.collection, 'update', function() {
|
||||
this.listenTo( self.collection, 'themes:update', function() {
|
||||
self.parent.page = 0;
|
||||
self.currentTheme();
|
||||
self.render( this );
|
||||
});
|
||||
} );
|
||||
|
||||
// Update theme count to full result set when available.
|
||||
this.listenTo( self.collection, 'query:success', function( count ) {
|
||||
@ -1478,7 +1478,7 @@ themes.view.Installer = themes.view.Appearance.extend({
|
||||
|
||||
// Construct the filter request
|
||||
// using the default values
|
||||
filter = _.union( filter, this.filtersChecked() );
|
||||
filter = _.union( [ filter, this.filtersChecked() ] );
|
||||
request = { tag: [ filter ] };
|
||||
|
||||
// Get the themes by sending Ajax POST request to api.wordpress.org/themes
|
||||
|
2
wp-admin/js/theme.min.js
vendored
2
wp-admin/js/theme.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-alpha-36579';
|
||||
$wp_version = '4.5-alpha-36580';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user