Making WordPress.org


Ignore:
Timestamp:
03/01/2016 08:10:20 PM (10 years ago)
Author:
ocean90
Message:

Translate: Add filters to plugin's contributors page and display the WP locale of a language pack.

See #1388.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-plugins-contributors.php

    r2439 r2660  
    4444
    4545        <h3>Activity</h3>
    46         <p>The graph shows the recent activity of your contributors. It's updated once per day.</p>
     46        <p>The graph shows the recent activity of your contributors. It&#8217;s updated once per day.</p>
    4747
    4848        <div class="ct-chart ct-chart-contributors"></div>
     
    5252        <?php
    5353        if ( $contributors_by_locale ) {
    54                 echo '<div class="contributors-list-search"><input type="search" placeholder="Filter teams&hellip;" id="contributors-list-search"></div>';
     54                ?>
     55                <div class="contributors-list-filter">
     56                        <button type="button" class="button-link filter active" data-filter="all">All</button> |
     57                        <button type="button" class="button-link filter" data-filter="has-editors">With Editors</button> |
     58                        <button type="button" class="button-link filter" data-filter="no-editors">Without Editors</button>
     59
     60                        <input type="search" class="search" placeholder="Filter teams&hellip;" id="contributors-list-search">
     61                </div>
     62                <?php
    5563                echo '<div id="contributors-list" class="contributors-list">';
    5664                foreach ( $contributors_by_locale as $locale_slug => $data ) {
    5765                        $locale = GP_Locales::by_slug( $locale_slug );
     66                        $has_editors = ! empty ( $data['editors'] );
    5867
    5968                        $editors_list = array();
     
    8493
    8594                        printf(
    86                                 '<div class="contributors-list-box">
     95                                '<div class="contributors-list-box%s">
    8796                                        <h4><span class="locale-name">%s<span> <span class="contributors-count">%s</span> <span class="locale-code">#%s</span></h4>
    8897                                        <p><strong>Editors:</strong> %s</p>
    8998                                        <p><strong>Contributors:</strong> %s</p>
    9099                                </div>',
     100                                $has_editors ? ' has-editors' : ' no-editors',
    91101                                $locale->english_name,
    92102                                sprintf( _n( '%s person', '%s persons', $data['count'] ), number_format_i18n( $data['count'] ) ),
     
    127137                        }).show();
    128138                }
     139        });
     140
     141        $( '.contributors-list-filter .filter' ).on( 'click', function() {
     142                var $el = $( this ), filter = $el.data( 'filter' );
     143
     144                $el.siblings( '.active' ).removeClass( 'active' );
     145                $el.addClass( 'active' );
     146                $( '#contributors-list' ).attr( 'data-current-filter', filter );
    129147        });
    130148});
Note: See TracChangeset for help on using the changeset viewer.