- Timestamp:
- 02/24/2017 05:47:30 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/theme.js
r40076 r40107 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 }); … … 572 572 this.listenTo( preview, 'preview:close', function() { 573 573 self.current = self.model; 574 }); 575 576 // Listen for closepreview events, closing the preview. 577 this.listenTo( preview, 'closepreview', function() { 578 preview.close(); 574 579 }); 575 580 }, … … 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() { … … 1909 1914 // Queries the API for the passed theme slug 1910 1915 themes.router.on( 'route:preview', function( slug ) { 1911 request.theme = slug; 1912 self.view.collection.query( request ); 1913 self.view.collection.once( 'update', function() { 1916 1917 // If the theme preview is active, set the current theme. 1918 if ( self.view.view.theme && self.view.view.theme.preview ) { 1919 self.view.view.theme.model = self.view.collection.findWhere( { 'slug': slug } ); 1914 1920 self.view.view.theme.preview(); 1915 }); 1921 } else { 1922 1923 // Select the theme by slug. 1924 request.theme = slug; 1925 self.view.collection.query( request ); 1926 self.view.collection.trigger( 'update' ); 1927 1928 // Open the theme preview. 1929 self.view.collection.once( 'query:success', function() { 1930 $( 'div[data-slug="' + slug + '"]' ).trigger( 'click' ); 1931 }) 1932 1933 } 1916 1934 }); 1917 1935 … … 1924 1942 } 1925 1943 self.view.sort( sort ); 1926 self.view.trigger( 'theme:close' ); 1944 1945 // Close the preview if open. 1946 if ( themes.currentPreview ) { 1947 themes.currentPreview.trigger( 'closepreview' ); 1948 } 1927 1949 }); 1928 1950
Note: See TracChangeset
for help on using the changeset viewer.