X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f..refs/tags/wordpress-4.1-scripts:/wp-admin/js/theme.js diff --git a/wp-admin/js/theme.js b/wp-admin/js/theme.js index 57e33127..344a8178 100644 --- a/wp-admin/js/theme.js +++ b/wp-admin/js/theme.js @@ -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' ); @@ -824,7 +824,7 @@ themes.view.Themes = wp.Backbone.View.extend({ index: 0, // The theme count element - count: $( '.theme-count' ), + count: $( '.wp-filter .theme-count' ), initialize: function( options ) { var self = this; @@ -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 ); }, @@ -1659,6 +1666,10 @@ $( document ).ready(function() { } else { themes.Run.init(); } + + $( '.broken-themes .delete-theme' ).on( 'click', function() { + return confirm( _wpThemeSettings.settings.confirmDelete ); + }); }); })( jQuery );