]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/theme.js
WordPress 4.1
[autoinstalls/wordpress.git] / wp-admin / js / theme.js
index 57e33127ac9fa84b809a957c9a88a2944bd82dca..344a8178eafff49955e1f123f862d143162eda94 100644 (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' );
@@ -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 );