Changeset 2072
- Timestamp:
- 11/11/2015 02:00:12 AM (9 years ago)
- Location:
- sites/trunk/translate.wordpress.org
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/locale.php
r1901 r2072 26 26 $page = (int) gp_get( 'page', 1 ); 27 27 $search = gp_get( 's', '' ); 28 $filter = gp_get( 'filter', 'default');28 $filter = gp_get( 'filter', false ); 29 29 30 30 $locale = GP_Locales::by_slug( $locale_slug ); … … 88 88 $sub_projects = $paged_sub_projects['projects']; 89 89 $pages = $paged_sub_projects['pages']; 90 $filter = $paged_sub_projects['filter']; 90 91 unset( $paged_sub_projects ); 91 92 … … 386 387 'set_slug' => '', 387 388 'locale' => '', 388 'filter' => 'default',389 'filter' => false, 389 390 ); 390 391 $r = wp_parse_args( $args, $defaults ); … … 408 409 if ( 'waiting' == $project->slug && GP::$user->current()->id && isset( GP::$plugins->wporg_rosetta_roles ) ) { 409 410 410 if ( 'default' ===$filter ) {411 $filter = 'strings-waiting ';411 if ( ! $filter ) { 412 $filter = 'strings-waiting-and-fuzzy'; 412 413 } 413 414 … … 452 453 453 454 $filter_order_by = $filter_where = ''; 454 switch ( $filter ) { 455 $sort_order = 'DESC'; 456 $filter_name = $filter; 457 if ( $filter && '-asc' == substr( $filter, -4 ) ) { 458 $sort_order = 'ASC'; 459 $filter_name = substr( $filter, 0, -4 ); 460 } 461 switch ( $filter_name ) { 455 462 default: 456 case ' default':463 case 'special': 457 464 // Float favorites to the start, but only if they have untranslated strings 458 465 $user_fav_projects = array_map( array( $gpdb, 'escape' ), $this->get_user_favorites( $project->slug ) ); … … 481 488 case 'strings-remaining': 482 489 $filter_where = 'AND stats.untranslated > 0'; 483 $filter_order_by = 'stats.untranslated DESC, tp.name ASC';490 $filter_order_by = "stats.untranslated $sort_order, tp.name ASC"; 484 491 break; 485 492 486 case 'strings-waiting ':493 case 'strings-waiting-and-fuzzy': 487 494 $filter_where = 'AND (stats.waiting > 0 OR stats.fuzzy > 0 )'; 488 495 $filter_order_by = "tp.path LIKE 'wp/%%' AND (stats.fuzzy + stats.waiting) > 0 DESC, (stats.fuzzy + stats.waiting) DESC, tp.name ASC"; 489 496 break; 490 497 491 case 'strings-fuzzy-and-warnings':492 $filter_where = 'AND ( stats.fuzzy > 0 OR stats.warnings > 0 )';493 $filter_order_by = '(stats.fuzzy+stats.warnings) DESC, tp.name ASC';494 break;495 496 498 case 'percent-completed': 497 499 $filter_where = 'AND stats.untranslated > 0'; 498 $filter_order_by = ' ( stats.current / stats.all ) DESC, tp.name ASC';500 $filter_order_by = "( stats.current / stats.all ) $sort_order, tp.name ASC"; 499 501 break; 500 502 } … … 534 536 'pages' => compact( 'pages', 'page', 'per_page', 'results' ), 535 537 'projects' => $projects, 538 'filter' => $filter, 536 539 ); 537 540 } -
sites/trunk/translate.wordpress.org/public_html/gp-templates/locale-projects.php
r1888 r2072 75 75 </div> 76 76 </div> 77 <div class="sort-bar"> 78 <select id="sort-filter" disabled="disabled"> 79 <?php 80 $sorts = array(); 81 if ( GP::$user->current()->id && in_array( $project->slug, array( 'waiting', 'wp-themes', 'wp-plugins' ) ) ) { 82 $sorts['special'] = 'Untranslated Favorites, Remaining Strings (Most first)'; 83 $sorts['favorites'] = 'My Favorites'; 84 } 85 $sorts['strings-remaining'] = 'Remaining Strings (Most first)'; 86 $sorts['strings-remaining-asc'] = 'Remaining Strings (Least first)'; 87 $sorts['strings-waiting-and-fuzzy'] = 'Waiting + Fuzzy (Most first)'; 88 $sorts['strings-waiting-and-fuzzy-asc'] = 'Waiting + Fuzzy (Least first)'; 89 $sorts['percent-completed'] = 'Percent Completed (Most first)'; 90 $sorts['percent-completed-asc'] = 'Percent Completed (Least first)'; 91 92 foreach ( $sorts as $value => $text ) { 93 printf( '<option value="%s" %s>%s</option>', esc_attr( $value ), ( $value == $filter ? 'selected="selected"' : '' ), esc_attr( $text ) ); 94 } 95 ?> 96 </select> 97 </div> 98 <script> 99 jQuery('#sort-filter').change( function() { 100 var current_url = document.location.href.replace(/[?&]filter=[^&$]*/, '' ); 101 document.location.replace( 102 current_url + 103 ( -1 == current_url.indexOf('?') ? '?filter=' : '&filter=' ) + 104 this.options[ this.options.selectedIndex ].value 105 ); 106 } ).prop('disabled', ''); 107 </script> 77 108 78 109 <div id="projects" class="projects"> -
sites/trunk/translate.wordpress.org/public_html/gp-templates/style.css
r2070 r2072 1024 1024 content: "\f142"; 1025 1025 } 1026 1027 .sort-bar { 1028 float: right; 1029 margin: -30px 0 5px 5px; 1030 background-color: #eee; 1031 padding: 5px; 1032 border: 1px solid #dfdfdf; 1033 border-top: none; 1034 }
Note: See TracChangeset
for help on using the changeset viewer.