Make WordPress Core

Changeset 30508


Ignore:
Timestamp:
11/21/2014 05:30:00 PM (11 years ago)
Author:
johnbillion
Message:

Abstract the theme browser route paths into attributes so they can be easily overridden.

Fixes #30116
Props matveb

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/theme.js

    r29924 r30508  
    764764        this.$el.html( this.html( data ) );
    765765
    766         themes.router.navigate( themes.router.baseUrl( '?theme=' + this.model.get( 'id' ) ), { replace: true } );
     766        themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.get( 'id' ) ), { replace: true } );
    767767
    768768        this.$el.fadeIn( 200, function() {
     
    997997
    998998        // Trigger a route update for the current model
    999         themes.router.navigate( themes.router.baseUrl( '?theme=' + this.model.id ) );
     999        themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.id ) );
    10001000
    10011001        // Sets this.view to 'detail'
     
    11331133        // Update the URL hash
    11341134        if ( event.target.value ) {
    1135             themes.router.navigate( themes.router.baseUrl( '?search=' + event.target.value ), options );
     1135            themes.router.navigate( themes.router.baseUrl( themes.router.searchPath + event.target.value ), options );
    11361136        } else {
    11371137            themes.router.navigate( themes.router.baseUrl( '' ) );
     
    11431143
    11441144        if ( event.target.value ) {
    1145             url = themes.router.baseUrl( '?search=' + event.target.value );
     1145            url = themes.router.baseUrl( themes.router.searchPath + event.target.value );
    11461146        }
    11471147
     
    11671167        return 'themes.php' + url;
    11681168    },
     1169
     1170    themePath: '?theme=',
     1171    searchPath: '?search=',
    11691172
    11701173    search: function( query ) {
     
    12971300
    12981301        // Set route
    1299         themes.router.navigate( themes.router.baseUrl( '?search=' + value ), { replace: true } );
     1302        themes.router.navigate( themes.router.baseUrl( themes.router.searchPath + value ), { replace: true } );
    13001303    }, 300 )
    13011304});
     
    13961399
    13971400        // Trigger a router.naviagte update
    1398         themes.router.navigate( themes.router.baseUrl( '?browse=' + sort ) );
     1401        themes.router.navigate( themes.router.baseUrl( themes.router.browsePath + sort ) );
    13991402    },
    14001403
     
    15681571        return 'theme-install.php' + url;
    15691572    },
     1573
     1574    themePath: '?theme=',
     1575    browsePath: '?browse=',
     1576    searchPath: '?search=',
    15701577
    15711578    search: function( query ) {
Note: See TracChangeset for help on using the changeset viewer.