Themes: Fix the routing for Themes in a sub-directory (/wp-content/themes/prefix/theme-name/style.css) and navigate to hash-url's for searches. See #25948

git-svn-id: https://develop.svn.wordpress.org/trunk@26513 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2013-12-02 00:47:49 +00:00
parent 50edc63cc9
commit e3d4717077

View File

@ -586,7 +586,14 @@ themes.view.Search = wp.Backbone.View.extend({
if ( event.type === 'keyup' && event.which === 27 ) { if ( event.type === 'keyup' && event.which === 27 ) {
event.target.value = ''; event.target.value = '';
} }
this.collection.doSearch( event.target.value ); this.collection.doSearch( event.target.value );
// Update the URL hash
if ( event.target.value )
themes.router.navigate( 'search/' + event.target.value );
else
themes.router.navigate( '' );
} }
}); });
@ -595,8 +602,8 @@ themes.view.Search = wp.Backbone.View.extend({
themes.routes = Backbone.Router.extend({ themes.routes = Backbone.Router.extend({
routes: { routes: {
'search/:query': 'search', 'search/*query': 'search',
'theme/:slug': 'theme' 'theme/*slug': 'theme'
}, },
// Set the search input value based on url // Set the search input value based on url