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({ |
491 | 491 | // Set focus to current theme. |
492 | 492 | themes.focusedTheme = this.$el; |
493 | 493 | |
494 | | // Construct a new Preview view. |
495 | | themes.currentPreview = preview = new themes.view.Preview({ |
| 494 | themes.preview = preview = new themes.view.Preview({ |
496 | 495 | model: this.model |
497 | 496 | }); |
498 | 497 | |
… |
… |
themes.view.Theme = wp.Backbone.View.extend({ |
573 | 572 | self.current = self.model; |
574 | 573 | }); |
575 | 574 | |
576 | | // Listen for closepreview events, closing the preview. |
577 | | this.listenTo( preview, 'closepreview', function() { |
578 | | preview.close(); |
579 | | }); |
580 | 575 | }, |
581 | 576 | |
582 | 577 | // Handles .disabled classes for previous/next buttons in theme installer preview |
… |
… |
themes.view.Preview = themes.view.Details.extend({ |
916 | 911 | } |
917 | 912 | }).removeClass( 'iframe-ready' ); |
918 | 913 | |
919 | | themes.router.navigate( themes.router.baseUrl( '' ) ); |
920 | 914 | this.trigger( 'preview:close' ); |
921 | 915 | this.undelegateEvents(); |
922 | 916 | this.unbind(); |
… |
… |
themes.RunInstaller = { |
1914 | 1908 | // Queries the API for the passed theme slug |
1915 | 1909 | themes.router.on( 'route:preview', function( slug ) { |
1916 | 1910 | |
| 1911 | // Construct a new Preview view. |
| 1912 | if ( themes.preview ) { |
| 1913 | themes.preview.undelegateEvents(); |
| 1914 | themes.preview.unbind(); |
| 1915 | } |
| 1916 | |
1917 | 1917 | // If the theme preview is active, set the current theme. |
1918 | 1918 | if ( self.view.view.theme && self.view.view.theme.preview ) { |
1919 | 1919 | self.view.view.theme.model = self.view.collection.findWhere( { 'slug': slug } ); |
… |
… |
themes.RunInstaller = { |
1943 | 1943 | self.view.sort( sort ); |
1944 | 1944 | |
1945 | 1945 | // Close the preview if open. |
1946 | | if ( themes.currentPreview ) { |
1947 | | themes.currentPreview.trigger( 'closepreview' ); |
| 1946 | if ( themes.preview ) { |
| 1947 | themes.preview.close(); |
1948 | 1948 | } |
1949 | 1949 | }); |
1950 | 1950 | |