Make WordPress Core

Ticket #36613: 36613.5.diff

File 36613.5.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 39ed26ad94..9b936da1bf 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                themes.preview = preview = new themes.view.Preview({
    496495                        model: this.model
    497496                });
    498497
    themes.view.Theme = wp.Backbone.View.extend({ 
    573572                        self.current = self.model;
    574573                });
    575574
    576                 // Listen for closepreview events, closing the preview.
    577                 this.listenTo( preview, 'closepreview', function() {
    578                         preview.close();
    579                 });
    580575        },
    581576
    582577        // Handles .disabled classes for previous/next buttons in theme installer preview
    themes.view.Preview = themes.view.Details.extend({ 
    916911                        }
    917912                }).removeClass( 'iframe-ready' );
    918913
    919                 themes.router.navigate( themes.router.baseUrl( '' ) );
    920914                this.trigger( 'preview:close' );
    921915                this.undelegateEvents();
    922916                this.unbind();
    themes.RunInstaller = { 
    19141908                // Queries the API for the passed theme slug
    19151909                themes.router.on( 'route:preview', function( slug ) {
    19161910
     1911                        // Construct a new Preview view.
     1912                        if ( themes.preview ) {
     1913                                themes.preview.undelegateEvents();
     1914                                themes.preview.unbind();
     1915                        }
     1916
    19171917                        // If the theme preview is active, set the current theme.
    19181918                        if ( self.view.view.theme && self.view.view.theme.preview ) {
    19191919                                self.view.view.theme.model = self.view.collection.findWhere( { 'slug': slug } );
    themes.RunInstaller = { 
    19431943                        self.view.sort( sort );
    19441944
    19451945                        // Close the preview if open.
    1946                         if ( themes.currentPreview ) {
    1947                                 themes.currentPreview.trigger( 'closepreview' );
     1946                        if ( themes.preview ) {
     1947                                themes.preview.close();
    19481948                        }
    19491949                });
    19501950