Ticket #27521: 27521.13.diff
File 27521.13.diff, 1.3 KB (added by , 11 years ago) |
---|
-
src/wp-admin/js/theme.js
442 442 this.touchDrag = true; 443 443 }, 444 444 445 // Handles .disabled classes for next/previous buttons in theme installer preview 446 setNavButtonsState: function() { 447 var $themeInstaller = $( '#theme-installer' ), 448 current = _.isUndefined( this.current ) ? this.model : this.current; 449 450 // Disable Left at the zero position 451 if ( 0 === this.model.collection.indexOf( current ) ) { 452 $themeInstaller.find( '.previous-theme' ).addClass( 'disabled' ); 453 } 454 455 // Disable next if the next model is undefined 456 if ( _.isUndefined( this.model.collection.at( this.model.collection.indexOf( current ) + 1 ) ) ) { 457 $themeInstaller.find( '.next-theme' ).addClass( 'disabled' ); 458 } 459 }, 460 461 445 462 preview: function( event ) { 446 463 var self = this, 447 464 current, preview; … … 504 521 505 522 // Render and append. 506 523 preview.render(); 524 this.setNavButtonsState(); 507 525 $( 'div.wrap' ).append( preview.el ); 508 526 }) 509 527 .listenTo( preview, 'theme:previous', function() { … … 531 549 532 550 // Render and append. 533 551 preview.render(); 552 this.setNavButtonsState(); 534 553 $( 'div.wrap' ).append( preview.el ); 535 554 }); 555 self.setNavButtonsState(); 536 556 } 537 557 }); 538 558