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