Changeset 40824
- Timestamp:
- 05/23/2017 08:32:00 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/theme.js
r40586 r40824 493 493 494 494 // Construct a new Preview view. 495 themes. currentPreview = preview = new themes.view.Preview({495 themes.preview = preview = new themes.view.Preview({ 496 496 model: this.model 497 497 }); … … 574 574 }); 575 575 576 // Listen for closepreview events, closing the preview.577 this.listenTo( preview, 'closepreview', function() {578 preview.close();579 });580 576 }, 581 577 … … 917 913 }).removeClass( 'iframe-ready' ); 918 914 919 themes.router.navigate( themes.router.baseUrl( '' ) ); 915 // Restore the previous browse tab if available. 916 if ( themes.router.selectedTab ) { 917 themes.router.navigate( themes.router.baseUrl( '?browse=' + themes.router.selectedTab ) ); 918 themes.router.selectedTab = false; 919 } else { 920 themes.router.navigate( themes.router.baseUrl( '' ) ); 921 } 920 922 this.trigger( 'preview:close' ); 921 923 this.undelegateEvents(); … … 1652 1654 this.clearSearch(); 1653 1655 1656 // Track sorting so we can restore the correct tab when closing preview. 1657 themes.router.selectedTab = sort; 1658 1654 1659 $( '.filter-links li > a, .theme-filter' ).removeClass( this.activeClass ); 1655 1660 $( '[data-sort="' + sort + '"]' ).addClass( this.activeClass ); … … 1915 1920 themes.router.on( 'route:preview', function( slug ) { 1916 1921 1922 // Remove existing handlers. 1923 if ( themes.preview ) { 1924 themes.preview.undelegateEvents(); 1925 themes.preview.unbind(); 1926 } 1927 1917 1928 // If the theme preview is active, set the current theme. 1918 1929 if ( self.view.view.theme && self.view.view.theme.preview ) { … … 1940 1951 if ( ! sort ) { 1941 1952 sort = 'featured'; 1953 themes.router.navigate( themes.router.baseUrl( '?browse=featured' ), { replace: true } ); 1942 1954 } 1943 1955 self.view.sort( sort ); 1944 1956 1945 1957 // Close the preview if open. 1946 if ( themes. currentPreview ) {1947 themes. currentPreview.trigger( 'closepreview');1958 if ( themes.preview ) { 1959 themes.preview.close(); 1948 1960 } 1949 1961 });
Note: See TracChangeset
for help on using the changeset viewer.