Ticket #27521: 27521.12.diff
File 27521.12.diff, 1.5 KB (added by , 9 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; … … 494 511 495 512 // If we have no more themes, bail. 496 513 if ( _.isUndefined( self.current ) ) { 514 self.options.parent.parent.trigger( 'theme:end' ); 497 515 return self.current = current; 498 516 } 499 517 … … 504 522 505 523 // Render and append. 506 524 preview.render(); 525 this.setNavButtonsState(); 507 526 $( 'div.wrap' ).append( preview.el ); 508 527 }) 509 528 .listenTo( preview, 'theme:previous', function() { … … 531 550 532 551 // Render and append. 533 552 preview.render(); 553 this.setNavButtonsState(); 534 554 $( 'div.wrap' ).append( preview.el ); 535 555 }); 556 self.setNavButtonsState(); 536 557 } 537 558 }); 538 559