Ticket #25963: 25963.12.diff
File 25963.12.diff, 3.8 KB (added by , 11 years ago) |
---|
-
wp-admin/js/theme.js
646 646 themes.routes = Backbone.Router.extend({ 647 647 648 648 initialize: function() { 649 this.routes = _.object([ 650 ]); 649 this.route( /^(.*?)/, 'parseThemeUri' ); 651 650 }, 652 651 652 // Parse URL route 653 parseThemeUri: function() { 654 var regex = /([^&=]+)=?([^&]*)/g, 655 params, key, value; 656 657 // Gets the url params from Backbone.history 658 params = regex.exec( Backbone.history.location.search ); 659 660 // Bail if we have no parameters 661 if ( ! params ) { 662 return; 663 } 664 665 key = params[1]; 666 value = params[2] 667 668 // Handles theme route 669 if ( key.indexOf( 'theme' ) !== -1 ) { 670 this.theme( value ); 671 } 672 673 // Handles search route 674 if ( key.indexOf( 'search' ) !== -1 ) { 675 this.search( value ); 676 } 677 }, 678 653 679 baseUrl: function( url ) { 654 680 return themes.data.settings.root + url; 681 }, 682 683 theme: function( slug ) { 684 // Trigger a route event of 'theme' 685 this.trigger( 'route:theme', slug ); 686 }, 687 688 search: function( term ) { 689 // Set the search input value based on url 690 $( '.theme-search' ).val( term ); 691 // Trigger a route event of 'search' 692 this.trigger( 'route:search', term ); 655 693 } 656 694 }); 657 695 … … 673 711 render: function() { 674 712 // Render results 675 713 this.view.render(); 714 715 // Calls the routes functionality 676 716 this.routes(); 677 717 /* 678 718 // Set the initial theme 679 719 if ( 'undefined' !== typeof themes.data.settings.theme && '' !== themes.data.settings.theme ){ 680 720 this.view.view.theme.trigger( 'theme:expand', this.view.collection.findWhere( { id: themes.data.settings.theme } ) ); … … 685 725 $( '.theme-search' ).val( themes.data.settings.search ); 686 726 this.themes.doSearch( themes.data.settings.search ); 687 727 } 688 728 */ 689 729 // Start the router if browser supports History API 690 730 if ( window.history && window.history.pushState ) { 691 731 // Calls the routes functionality 692 Backbone.history.start({ pushState: true , silent: true});732 Backbone.history.start({ pushState: true }); 693 733 } 694 734 }, 695 735 696 736 routes: function() { 737 var self = this; 697 738 // Bind to our global thx object 698 739 // so that the object is available to sub-views 699 740 themes.router = new themes.routes(); 741 742 // Handles theme details route event 743 themes.router.on( 'route:theme', function( slug ) { 744 self.view.view.expand( slug ); 745 }); 746 747 // Handles search route event 748 themes.router.on( 'route:search', function( query ) { 749 self.themes.doSearch( query ); 750 }); 700 751 } 701 752 }; 702 753 -
wp-admin/themes.php
100 100 'installURI' => ( ! is_multisite() && current_user_can( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null, 101 101 'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ), 102 102 'root' => parse_url( admin_url( 'themes.php' ), PHP_URL_PATH ), 103 'theme' => esc_html( $theme ),104 'search' => esc_html( $search ),105 106 103 ), 107 108 109 'search'=> __( 'Search Installed Themes' ),110 111 104 'l10n' => array( 105 'addNew' => __( 'Add New Theme' ), 106 'search' => __( 'Search Installed Themes' ), 107 'searchPlaceholder' => __( 'Search installed themes...' ), 108 ), 112 109 ) ); 113 110 114 111 add_thickbox(); … … 279 276 <# } #> 280 277 <span class="more-details"><?php _e( 'Theme Details' ); ?></span> 281 278 <div class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.author }}}' ); ?></div> 282 279 283 280 <# if ( data.active ) { #> 284 281 <h3 class="theme-name"><span><?php _ex( 'Active:', 'theme' ); ?></span> {{{ data.name }}}</h3> 285 282 <# } else { #>