diff --git src/wp-admin/js/theme.js src/wp-admin/js/theme.js
index 39ed26ad94..9e1d87de46 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( '' ) ); |
| | 914 | // Restore the previous browse tab if available. |
| | 915 | if ( themes.router.selectedTab ) { |
| | 916 | themes.router.navigate( themes.router.baseUrl( '?browse=' + themes.router.selectedTab ) ); |
| | 917 | themes.router.selectedTab = false; |
| | 918 | } else { |
| | 919 | themes.router.navigate( themes.router.baseUrl( '' ) ); |
| | 920 | } |
| 920 | 921 | this.trigger( 'preview:close' ); |
| 921 | 922 | this.undelegateEvents(); |
| 922 | 923 | this.unbind(); |
| … |
… |
themes.view.Installer = themes.view.Appearance.extend({ |
| 1651 | 1652 | sort: function( sort ) { |
| 1652 | 1653 | this.clearSearch(); |
| 1653 | 1654 | |
| | 1655 | // Track sorting so we can restore the correct tab when closing preview. |
| | 1656 | themes.router.selectedTab = 'featured' === sort ? '' : sort; |
| | 1657 | |
| 1654 | 1658 | $( '.filter-links li > a, .theme-filter' ).removeClass( this.activeClass ); |
| 1655 | 1659 | $( '[data-sort="' + sort + '"]' ).addClass( this.activeClass ); |
| 1656 | 1660 | |
| … |
… |
themes.RunInstaller = { |
| 1914 | 1918 | // Queries the API for the passed theme slug |
| 1915 | 1919 | themes.router.on( 'route:preview', function( slug ) { |
| 1916 | 1920 | |
| | 1921 | // Construct a new Preview view. |
| | 1922 | if ( themes.preview ) { |
| | 1923 | themes.preview.undelegateEvents(); |
| | 1924 | themes.preview.unbind(); |
| | 1925 | } |
| | 1926 | |
| 1917 | 1927 | // If the theme preview is active, set the current theme. |
| 1918 | 1928 | if ( self.view.view.theme && self.view.view.theme.preview ) { |
| 1919 | 1929 | self.view.view.theme.model = self.view.collection.findWhere( { 'slug': slug } ); |
| … |
… |
themes.RunInstaller = { |
| 1943 | 1953 | self.view.sort( sort ); |
| 1944 | 1954 | |
| 1945 | 1955 | // Close the preview if open. |
| 1946 | | if ( themes.currentPreview ) { |
| 1947 | | themes.currentPreview.trigger( 'closepreview' ); |
| | 1956 | if ( themes.preview ) { |
| | 1957 | themes.preview.close(); |
| 1948 | 1958 | } |
| 1949 | 1959 | }); |
| 1950 | 1960 | |