Abstract the theme browser route paths into attributes so they can be easily overridden.

Fixes #30116
Props matveb

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


git-svn-id: http://core.svn.wordpress.org/trunk@30497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2014-11-21 17:30:22 +00:00
parent b66c58f76a
commit 78367f22d5
3 changed files with 15 additions and 8 deletions

View File

@ -763,7 +763,7 @@ themes.view.Preview = themes.view.Details.extend({
this.$el.html( this.html( data ) );
themes.router.navigate( themes.router.baseUrl( '?theme=' + this.model.get( 'id' ) ), { replace: true } );
themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.get( 'id' ) ), { replace: true } );
this.$el.fadeIn( 200, function() {
$( 'body' ).addClass( 'theme-installer-active full-overlay-active' );
@ -996,7 +996,7 @@ themes.view.Themes = wp.Backbone.View.extend({
this.model = self.collection.get( id );
// Trigger a route update for the current model
themes.router.navigate( themes.router.baseUrl( '?theme=' + this.model.id ) );
themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.id ) );
// Sets this.view to 'detail'
this.setView( 'detail' );
@ -1132,7 +1132,7 @@ themes.view.Search = wp.Backbone.View.extend({
// Update the URL hash
if ( event.target.value ) {
themes.router.navigate( themes.router.baseUrl( '?search=' + event.target.value ), options );
themes.router.navigate( themes.router.baseUrl( themes.router.searchPath + event.target.value ), options );
} else {
themes.router.navigate( themes.router.baseUrl( '' ) );
}
@ -1142,7 +1142,7 @@ themes.view.Search = wp.Backbone.View.extend({
var url = themes.router.baseUrl( '' );
if ( event.target.value ) {
url = themes.router.baseUrl( '?search=' + event.target.value );
url = themes.router.baseUrl( themes.router.searchPath + event.target.value );
}
this.searching = false;
@ -1167,6 +1167,9 @@ themes.Router = Backbone.Router.extend({
return 'themes.php' + url;
},
themePath: '?theme=',
searchPath: '?search=',
search: function( query ) {
$( '.wp-filter-search' ).val( query );
},
@ -1296,7 +1299,7 @@ themes.view.InstallerSearch = themes.view.Search.extend({
this.collection.query( request );
// Set route
themes.router.navigate( themes.router.baseUrl( '?search=' + value ), { replace: true } );
themes.router.navigate( themes.router.baseUrl( themes.router.searchPath + value ), { replace: true } );
}, 300 )
});
@ -1395,7 +1398,7 @@ themes.view.Installer = themes.view.Appearance.extend({
this.sort( sort );
// Trigger a router.naviagte update
themes.router.navigate( themes.router.baseUrl( '?browse=' + sort ) );
themes.router.navigate( themes.router.baseUrl( themes.router.browsePath + sort ) );
},
sort: function( sort ) {
@ -1568,6 +1571,10 @@ themes.InstallerRouter = Backbone.Router.extend({
return 'theme-install.php' + url;
},
themePath: '?theme=',
browsePath: '?browse=',
searchPath: '?search=',
search: function( query ) {
$( '.wp-filter-search' ).val( query );
},

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.1-beta2-30507';
$wp_version = '4.1-beta2-30508';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.