Make WordPress Core

Ticket #36613: 36613.4.diff

File 36613.4.diff, 1.8 KB (added by adamsilverstein, 8 years ago)
  • src/wp-admin/js/theme.js

    diff --git src/wp-admin/js/theme.js src/wp-admin/js/theme.js
    index 39ed26a..4c7f68d 100644
    themes.view.Theme = wp.Backbone.View.extend({ 
    491491                // Set focus to current theme.
    492492                themes.focusedTheme = this.$el;
    493493
    494                 // Construct a new Preview view.
    495                 themes.currentPreview = preview = new themes.view.Preview({
     494
     495                themes.preview = preview = new themes.view.Preview({
    496496                        model: this.model
    497497                });
    498498
    themes.view.Theme = wp.Backbone.View.extend({ 
    573573                        self.current = self.model;
    574574                });
    575575
    576                 // Listen for closepreview events, closing the preview.
    577                 this.listenTo( preview, 'closepreview', function() {
    578                         preview.close();
    579                 });
    580576        },
    581577
    582578        // Handles .disabled classes for previous/next buttons in theme installer preview
    themes.view.Preview = themes.view.Details.extend({ 
    907903        },
    908904
    909905        close: function() {
     906
    910907                this.$el.fadeOut( 200, function() {
    911908                        $( 'body' ).removeClass( 'theme-installer-active full-overlay-active' );
    912909
    themes.RunInstaller = { 
    19141911                // Queries the API for the passed theme slug
    19151912                themes.router.on( 'route:preview', function( slug ) {
    19161913
     1914                        // Construct a new Preview view.
     1915                        if ( themes.preview ) {
     1916                                themes.preview.undelegateEvents();
     1917                                themes.preview.unbind();
     1918                        }
     1919
    19171920                        // If the theme preview is active, set the current theme.
    19181921                        if ( self.view.view.theme && self.view.view.theme.preview ) {
    19191922                                self.view.view.theme.model = self.view.collection.findWhere( { 'slug': slug } );
    themes.RunInstaller = { 
    19431946                        self.view.sort( sort );
    19441947
    19451948                        // Close the preview if open.
    1946                         if ( themes.currentPreview ) {
    1947                                 themes.currentPreview.trigger( 'closepreview' );
     1949                        if ( themes.preview ) {
     1950                                themes.preview.close();
    19481951                        }
    19491952                });
    19501953