Ticket #36613: 36613.diff
File 36613.diff, 2.3 KB (added by , 8 years ago) |
---|
-
src/wp-admin/js/theme.js
492 492 themes.focusedTheme = this.$el; 493 493 494 494 // Construct a new Preview view. 495 preview = new themes.view.Preview({495 themes.currentPreview = preview = new themes.view.Preview({ 496 496 model: this.model 497 497 }); 498 498 … … 572 572 this.listenTo( preview, 'preview:close', function() { 573 573 self.current = self.model; 574 574 }); 575 576 // Listen for closepreview events, closing the preview. 577 this.listenTo( preview, 'closepreview', function() { 578 preview.close(); 579 }); 575 580 }, 576 581 577 582 // Handles .disabled classes for previous/next buttons in theme installer preview … … 885 890 self.tooglePreviewDeviceButtons( currentPreviewDevice ); 886 891 } 887 892 888 themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.get( 'id' ) ), { replace: true } );893 themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.get( 'id' ) ), { replace: false } ); 889 894 890 895 this.$el.fadeIn( 200, function() { 891 896 $body.addClass( 'theme-installer-active full-overlay-active' ); … … 1902 1907 // Handles `theme` route event 1903 1908 // Queries the API for the passed theme slug 1904 1909 themes.router.on( 'route:preview', function( slug ) { 1905 request.theme = slug; 1906 self.view.collection.query( request ); 1907 self.view.collection.once( 'update', function() { 1910 1911 // If the theme preview is active, set the current theme. 1912 if ( self.view.view.theme && self.view.view.theme.preview ) { 1913 self.view.view.theme.model = self.view.collection.findWhere( { 'slug': slug } ); 1908 1914 self.view.view.theme.preview(); 1909 }); 1915 } else { 1916 1917 // Open the theme preview. 1918 request.theme = slug; 1919 self.view.collection.query( request ); 1920 self.view.collection.trigger( 'update' ); 1921 } 1910 1922 }); 1911 1923 1912 1924 // Handles sorting / browsing routes … … 1917 1929 sort = 'featured'; 1918 1930 } 1919 1931 self.view.sort( sort ); 1920 self.view.trigger( 'theme:close' ); 1932 1933 // Close the current preview. 1934 if ( themes.currentPreview ) { 1935 themes.currentPreview.trigger( 'closepreview' ); 1936 } 1921 1937 }); 1922 1938 1923 1939 // The `search` route event. The router populates the input field.