Making WordPress.org


Ignore:
Timestamp:
07/14/2015 05:42:00 AM (9 years ago)
Author:
dd32
Message:

Translate: Add paging to the project portals. Currently paging is set to 20 per page.
See #1091

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/translate.wordpress.org/public_html/gp-templates/locale-projects.php

    r1734 r1739  
    6868    </ul>
    6969    <div class="search-form">
    70         <label class="screen-reader-text" for="projects-filter"><?php esc_attr_e( 'Search projects...' ); ?></label>
    71         <input placeholder="<?php esc_attr_e( 'Search projects...' ); ?>" type="search" id="projects-filter" class="filter-search">
     70        <form>
     71            <label class="screen-reader-text" for="projects-filter"><?php esc_attr_e( 'Search projects...' ); ?></label>
     72            <input placeholder="<?php esc_attr_e( 'Search projects...' ); ?>" type="search" id="projects-filter" name="s" value="<?php if ( !empty( $search ) ) { echo esc_attr( $search ); } ?>" class="filter-search">
     73            <input type="submit" value="<?php esc_attr_e( 'Search' ); ?>" class="screen-reader-text" />
     74        </form>
    7275    </div>
    7376</div>
     
    140143    ?>
    141144</div>
     145<?php
     146    if ( isset( $pages ) && $pages['pages'] > 1 ) {
     147        echo gp_pagination( $pages['page'], $pages['per_page'], $pages['results'] );
     148    }
     149?>
    142150
    143151<script>
    144152    jQuery( document ).ready( function( $ ) {
     153        // Don't filter if there's an existing search term, or if we're paginated
     154        // Fall back to a full page reload for those cases.
     155        var live_filtering_enabled = ( ! $( '#projects-filter' ).val() && ! $( '.paging' ).length );
    145156        $rows = $( '#projects' ).find( '.project' );
    146157        $( '#projects-filter' ).on( 'input keyup', function() {
     158            if ( ! live_filtering_enabled ) {
     159                return;
     160            }
     161
    147162            var words = this.value.toLowerCase().split( ' ' );
    148163
Note: See TracChangeset for help on using the changeset viewer.