Changeset 8497
- Timestamp:
- 03/24/2019 05:14:26 PM (6 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/locale-project.php
r7480 r8497 207 207 <table class="locale-project-contributors-table"> 208 208 <thead> 209 <th class="contributor-name">Contributor</th> 210 <th class="contributor-stats">Translations*</th> 209 <tr> 210 <th class="contributor-name">Contributor</th> 211 <th class="contributor-stats">Translations</th> 212 </tr> 211 213 </thead> 212 214 <tbody> 213 215 <?php 214 216 foreach ( $locale_contributors['contributors'] as $contributor ) { 217 $detailed = ''; 218 219 if ( 'wp-plugins' === $project->path ) { 220 // Ensure consistent order of development and stable projects. 221 usort( $contributor->detailed, function( $a, $b ) { 222 return strnatcasecmp( $a->project->name, $b->project->name ); 223 } ); 224 } 225 226 foreach ( $contributor->detailed as $detail_project_id => $detail_data ) { 227 $detailed .= '<strong class="detailed__project-name">' . $detail_data->project->name . ':</strong>'; 228 229 if ( $detail_data->total_count > 0 ) { 230 $total_count = gp_link_get( 231 gp_url_project( 232 $detail_data->project->path, 233 gp_url_join( $locale->slug, $set_slug ), 234 [ 235 'filters[translated]' => 'yes', 236 'filters[status]' => 'current_or_waiting_or_fuzzy_or_untranslated', 237 'filters[user_login]' => $contributor->login, 238 ] 239 ), 240 number_format_i18n( $detail_data->total_count ) 241 ); 242 } else { 243 $total_count = number_format_i18n( $detail_data->total_count ); 244 } 245 246 if ( $detail_data->current_count > 0 ) { 247 $current_count = gp_link_get( 248 gp_url_project( 249 $detail_data->project->path, 250 gp_url_join( $locale->slug, $set_slug ), 251 [ 252 'filters[translated]' => 'yes', 253 'filters[status]' => 'current', 254 'filters[user_login]' => $contributor->login, 255 ] 256 ), 257 number_format_i18n( $detail_data->current_count ) 258 ); 259 } else { 260 $current_count = number_format_i18n( $detail_data->current_count ); 261 } 262 263 if ( $detail_data->waiting_count > 0 ) { 264 $waiting_count = gp_link_get( 265 gp_url_project( 266 $detail_data->project->path, 267 gp_url_join( $locale->slug, $set_slug ), 268 [ 269 'filters[translated]' => 'yes', 270 'filters[status]' => 'waiting', 271 'filters[user_login]' => $contributor->login, 272 ] 273 ), 274 number_format_i18n( $detail_data->waiting_count ) 275 ); 276 } else { 277 $waiting_count = number_format_i18n( $detail_data->waiting_count ); 278 } 279 280 if ( $detail_data->fuzzy_count > 0 ) { 281 $fuzzy_count = gp_link_get( 282 gp_url_project( 283 $detail_data->project->path, 284 gp_url_join( $locale->slug, $set_slug ), 285 [ 286 'filters[translated]' => 'yes', 287 'filters[status]' => 'fuzzy', 288 'filters[user_login]' => $contributor->login, 289 ] 290 ), 291 number_format_i18n( $detail_data->fuzzy_count ) 292 ); 293 } else { 294 $fuzzy_count = number_format_i18n( $detail_data->fuzzy_count ); 295 } 296 297 $detailed .= sprintf( 298 ' 299 <div class="total"> 300 <p>%s</p> 301 </div> 302 <div class="current"> 303 <p>%s</p> 304 </div> 305 <div class="waiting"> 306 <p>%s</p> 307 </div> 308 <div class="fuzzy"> 309 <p>%s</p> 310 </div> 311 ', 312 $total_count, 313 $current_count, 314 $waiting_count, 315 $fuzzy_count 316 ); 317 } 318 215 319 printf( 216 320 '<tr> … … 218 322 %s 219 323 <a href="https://profiles.wordpress.org/%s/">%s %s</a> 220 <span>Last Activity: %s ago</span>324 <span>Last translation submitted: %s ago</span> 221 325 </td> 222 326 <td class="contributor-stats"> … … 237 341 <p>%s</p> 238 342 </div> 239 <td> 343 <div class="detailed"> 344 <details> 345 <summary>Per project</summary> 346 %s 347 </details> 348 </div> 349 </td> 240 350 </tr>', 241 351 $contributor->is_editor ? '<span class="translation-editor">Editor</span>' : '', 242 352 $contributor->nicename, 243 353 get_avatar( $contributor->email, 40 ), 244 $contributor->display_name ? $contributor->display_name: $contributor->nicename,354 $contributor->display_name ?: $contributor->nicename, 245 355 human_time_diff( strtotime( $contributor->last_update ) ), 246 356 number_format_i18n( $contributor->total_count ), 247 357 number_format_i18n( $contributor->current_count ), 248 358 number_format_i18n( $contributor->waiting_count ), 249 number_format_i18n( $contributor->fuzzy_count ) 359 number_format_i18n( $contributor->fuzzy_count ), 360 $detailed 250 361 ); 251 362 } … … 253 364 </tbody> 254 365 </table> 255 <p class="stats-hint">* Data for the last 365 days.</p>256 366 <?php else : ?> 257 367 <p>None, be the first?</p> … … 272 382 $editor->nicename, 273 383 get_avatar( $editor->email, 40 ), 274 $editor->display_name ? $editor->display_name: $editor->nicename384 $editor->display_name ?: $editor->nicename 275 385 ); 276 386 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/style.css
r8496 r8497 1773 1773 .locale-project-contributors-table td.contributor-stats div.fuzzy span { 1774 1774 color: #f78b53; 1775 } 1776 1777 .locale-project-contributors-table td.contributor-stats .detailed { 1778 width: 100%; 1779 clear: left; 1780 float: none; 1781 } 1782 1783 .detailed summary { 1784 text-align: right; 1785 font-size: 10px; 1786 outline: none; 1787 cursor: pointer; 1788 } 1789 1790 .detailed__project-name { 1791 display: block; 1792 clear: left; 1793 text-align: left; 1794 font-size: 10px; 1795 padding-top: 5px; 1775 1796 } 1776 1797 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-locale.php
r8496 r8497 503 503 } 504 504 505 $projects = []; 506 505 507 // Get the names of the contributors. 506 508 foreach ( $contributors as $contributor ) { … … 516 518 $locale_contributors['contributors'][ $contributor->user_id ]->waiting_count += $contributor->waiting_count; 517 519 $locale_contributors['contributors'][ $contributor->user_id ]->fuzzy_count += $contributor->fuzzy_count; 520 521 if ( ! isset( $projects[ $contributor->project_id ] ) ) { 522 $projects[ $contributor->project_id ] = GP::$project->get( $contributor->project_id ); 523 } 524 525 $locale_contributors['contributors'][ $contributor->user_id ]->detailed[ $contributor->project_id ] = (object) [ 526 'total_count' => $contributor->total_count, 527 'current_count' => $contributor->current_count, 528 'waiting_count' => $contributor->waiting_count, 529 'fuzzy_count' => $contributor->fuzzy_count, 530 'project' => $projects[ $contributor->project_id ], 531 ]; 532 518 533 continue; 519 534 } … … 524 539 } 525 540 541 if ( ! isset( $projects[ $contributor->project_id ] ) ) { 542 $projects[ $contributor->project_id ] = GP::$project->get( $contributor->project_id ); 543 } 544 526 545 $locale_contributors['contributors'][ $contributor->user_id ] = (object) array( 546 'login' => $user->user_login, 527 547 'nicename' => $user->user_nicename, 528 548 'display_name' => $this->_encode( $user->display_name ), … … 533 553 'waiting_count' => $contributor->waiting_count, 534 554 'fuzzy_count' => $contributor->fuzzy_count, 555 'detailed' => [ 556 $contributor->project_id => (object) [ 557 'total_count' => $contributor->total_count, 558 'current_count' => $contributor->current_count, 559 'waiting_count' => $contributor->waiting_count, 560 'fuzzy_count' => $contributor->fuzzy_count, 561 'project' => $projects[ $contributor->project_id ], 562 ], 563 ], 535 564 'is_editor' => in_array( $user->ID, $editor_ids ), 536 565 ); … … 557 586 SELECT 558 587 `t`.`user_id` as `user_id`, 588 `o`.`project_id` as `project_id`, 559 589 MAX( `t`.`date_added` ) AS `last_update`, 560 590 COUNT( * ) as `total_count`, … … 569 599 AND `t`.`user_id` IS NOT NULL AND `t`.`user_id` != 0 570 600 AND `t`.`status` IN( 'current', 'waiting', 'fuzzy' ) 571 AND `t`.`date_modified` > %s572 601 GROUP BY `t`.`user_id` 573 ", $translation_set->id , date( 'Y-m-d', time() - YEAR_IN_SECONDS )) );602 ", $translation_set->id ) ); 574 603 575 604 return $contributors;
Note: See TracChangeset
for help on using the changeset viewer.