From e3d47170775a3446c3aebeb58d99ad0b49c81284 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Mon, 2 Dec 2013 00:47:49 +0000 Subject: [PATCH] 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 --- src/wp-admin/js/theme.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/js/theme.js b/src/wp-admin/js/theme.js index b144157117..4977d26493 100644 --- a/src/wp-admin/js/theme.js +++ b/src/wp-admin/js/theme.js @@ -586,7 +586,14 @@ themes.view.Search = wp.Backbone.View.extend({ if ( event.type === 'keyup' && event.which === 27 ) { 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({ routes: { - 'search/:query': 'search', - 'theme/:slug': 'theme' + 'search/*query': 'search', + 'theme/*slug': 'theme' }, // Set the search input value based on url