WordPress.org

Making WordPress.org

Changeset 2037


Ignore:
Timestamp:
11/04/2015 04:59:09 PM (5 years ago)
Author:
ocean90
Message:

Rosetta Roles: Include project slugs in search fields.

Also bump checked projects to the top.

Fixes #1356.

Location:
sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/js/rosetta-roles.js

    r1786 r2037  
    131131        // @uses RegExp
    132132        search: function( term ) {
    133             var match, name;
     133            var match;
    134134
    135135            // Escape the term string for RegExp meta characters
     
    143143            // Find results
    144144            this.each( function( project ) {
    145                 name = project.get( 'name' );
    146                 project.set( 'isVisible', match.test( name ) );
    147             });
    148         },
     145                var haystack = _.union( project.get( 'name' ), project.get( 'slug' ) );
     146                project.set( 'isVisible', match.test( haystack ) );
     147            });
     148        },
     149
     150        comparator: function( project ) {
     151            return - project.get( 'checked' );
     152        }
    149153    });
    150154
  • sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/rosetta-roles.php

    r2001 r2037  
    221221     */
    222222    public function enqueue_scripts() {
    223         wp_enqueue_script( 'rosetta-roles', plugins_url( '/js/rosetta-roles.js', __FILE__ ), array( 'jquery', 'wp-backbone' ), '2', true );
     223        wp_enqueue_script( 'rosetta-roles', plugins_url( '/js/rosetta-roles.js', __FILE__ ), array( 'jquery', 'wp-backbone' ), '3', true );
    224224    }
    225225
     
    656656
    657657        $_projects = $wpdb->get_results( "
    658             SELECT id, name, parent_project_id
     658            SELECT id, name, parent_project_id, slug
    659659            FROM translate_projects
    660660            WHERE id NOT IN( " . implode( ',', $ignore_project_ids ) . " )
Note: See TracChangeset for help on using the changeset viewer.