Making WordPress.org

Changeset 1297


Ignore:
Timestamp:
02/24/2015 05:19:35 AM (10 years ago)
Author:
obenland
Message:

WP.org Themes: Improve index guessing for tags and search index pages.

See #850.

File:
1 edited

Legend:

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

    r1296 r1297  
    468468        collapse: function( event ) {
    469469            var self = this,
    470                 scroll, sorter;
     470                scroll, search, tags, sorter;
    471471
    472472            event = event || window.event;
     
    495495                    scroll = document.body.scrollTop;
    496496
    497                     sorter = $( '.filter-links .current' );
    498 
    499497                    // Clean the url structure
    500                     wp.themes.router.navigate( wp.themes.router.baseUrl( wp.themes.router.browsePath + sorter.data( 'sort' ) ) );
    501                     wp.themes.utils.title( sorter.text() );
     498                    if ( search = $( '#wp-filter-search-input' ).val() ) {
     499                        wp.themes.router.navigate( wp.themes.router.baseUrl( wp.themes.router.searchPath + search ) );
     500                        wp.themes.utils.title( search );
     501                    }
     502                    else if ( tags = wp.themes.view.Installer.prototype.filtersChecked() ) {
     503                        wp.themes.router.navigate( wp.themes.router.baseUrl( 'tag/' + tags.join( '+' ) ) );
     504                        wp.themes.utils.title( _.each( tags, function( tag, i ) {
     505                            tags[ i ] = $( 'label[for="filter-id-' + tag + '"]' ).text();
     506                        }).join( ', ' ) );
     507                    }
     508                    else if ( sorter = $( '.filter-links .current' ) ) {
     509                        wp.themes.router.navigate( wp.themes.router.baseUrl( wp.themes.router.browsePath + sorter.data( 'sort' ) ) );
     510                        wp.themes.utils.title( sorter.text() );
     511                    }
    502512
    503513                    // Restore scroll position
     
    603613                wp.themes.router.navigate( wp.themes.router.baseUrl( wp.themes.router.searchPath + value ), { replace: true } );
    604614            } else {
    605                 wp.themes.router.navigate( wp.themes.router.baseUrl( themes.router.browsePath + sort ) );
     615                wp.themes.router.navigate( wp.themes.router.baseUrl( wp.themes.router.browsePath + sort ) );
    606616                this.parent.sort( sort );
    607617            }
Note: See TracChangeset for help on using the changeset viewer.