Ticket #36613: 36613.2.diff
File 36613.2.diff, 2.4 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 // Select the theme by slug. 1918 request.theme = slug; 1919 self.view.collection.query( request ); 1920 self.view.collection.trigger( 'update' ); 1921 1922 // Open the theme preview. 1923 self.view.collection.once( 'query:success', function() { 1924 $( 'div[data-slug="' + slug + '"]' ).trigger( 'click' ); 1925 }) 1926 1927 } 1910 1928 }); 1911 1929 1912 1930 // Handles sorting / browsing routes … … 1917 1935 sort = 'featured'; 1918 1936 } 1919 1937 self.view.sort( sort ); 1920 self.view.trigger( 'theme:close' ); 1938 1939 // Close the current preview. 1940 if ( themes.currentPreview ) { 1941 themes.currentPreview.trigger( 'closepreview' ); 1942 } 1921 1943 }); 1922 1944 1923 1945 // The `search` route event. The router populates the input field.