Making WordPress.org

Changeset 1152


Ignore:
Timestamp:
01/16/2015 02:25:52 AM (10 years ago)
Author:
obenland
Message:

WP.org Themes: Improve route recognition and handling.

  • Fixes a bug where routes weren't recognized properly after r1119.
  • Properly checks the approprite filters on tag "archives".
  • Adds support for author "archives".

See #745.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.js

    r1119 r1152  
    330330    _.extend( wp.themes.InstallerRouter.prototype, {
    331331        routes: {
    332             '/:slug/': 'preview',
    333             '/tag/:tag/': 'onFilter',
    334             '/?upload': 'upload',
    335             '/search.php?q=:query': 'search',
    336             '/browse/:sort/': 'sort',
    337             '/': 'sort',
     332            'browse/:sort/': 'sort',
     333            'tag/:tag/': 'tag',
     334            'search/:query/': 'search',
     335            'author/:author/': 'author',
     336            ':slug/': 'preview',
    338337            '': 'sort'
    339338        },
     
    345344        themePath: '',
    346345        browsePath: 'browse/',
    347         searchPath: 'search.php?q='
     346        searchPath: 'search/'
    348347    });
    349348
    350349    _.extend( wp.themes.RunInstaller, {
    351350        extraRoutes: function() {
    352             var self = this;
     351            var self = this,
     352            request = {};
    353353
    354354            wp.themes.router.on( 'route:tag', function( tag ) {
    355                 $( '#filter-id-' + tag).checked( true );
     355                $( '#filter-id-' + tag).prop( 'checked', true );
    356356                self.view.applyFilters();
    357357            });
     358
     359            wp.themes.router.on( 'route:author', function( author ) {
     360                request.author = author;
     361                self.view.collection.query( request );
     362            });
    358363        }
    359364    });
Note: See TracChangeset for help on using the changeset viewer.