Changeset 2667
- Timestamp:
- 03/02/2016 02:54:02 PM (9 years ago)
- Location:
- sites/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/translate.wordpress.org/public_html/gp-templates-new/locale-project.php
r2663 r2667 183 183 <h3>Translation Contributors</h3> 184 184 <?php if ( $locale_contributors['contributors'] ) : ?> 185 <ul> 185 <table class="locale-project-contributors-table"> 186 <thead> 187 <th class="contributor-name">Contributor</th> 188 <th class="contributor-stats">Translations*</th> 189 </thead> 190 <tbody> 186 191 <?php 187 192 foreach ( $locale_contributors['contributors'] as $contributor ) { 188 193 printf( 189 '<li><a href="https://profiles.wordpress.org/%s/">%s %s</a></li>', 194 '<tr> 195 <td class="contributor-name"> 196 <a href="https://profiles.wordpress.org/%s/">%s %s</a> 197 <span>Last Activity: %s ago</span> 198 </td> 199 <td class="contributor-stats"> 200 <div class="total"> 201 <span>Total</span> 202 <p>%s</p> 203 </div> 204 <div class="current"> 205 <span>Translated</span> 206 <p>%s</p> 207 </div> 208 <div class="waiting"> 209 <span>Suggested</span> 210 <p>%s</p> 211 </div> 212 <div class="fuzzy"> 213 <span>Fuzzy</span> 214 <p>%s</p> 215 </div> 216 <td> 217 </tr>', 190 218 $contributor->nicename, 191 get_avatar( $contributor->email, 30 ), 192 $contributor->display_name ? $contributor->display_name : $contributor->nicename 219 get_avatar( $contributor->email, 40 ), 220 $contributor->display_name ? $contributor->display_name : $contributor->nicename, 221 human_time_diff( strtotime( $contributor->last_update ) ), 222 number_format_i18n( $contributor->total_count ), 223 number_format_i18n( $contributor->current_count ), 224 number_format_i18n( $contributor->waiting_count ), 225 number_format_i18n( $contributor->fuzzy_count ) 193 226 ); 194 227 } 195 228 ?> 196 </ul> 229 </tbody> 230 </table> 231 <p class="stats-hint">* Data for the last 356 days.</p> 197 232 <?php else : ?> 198 233 <p>None, be the first?</p> 199 234 <?php endif; ?> 200 235 </div> 201 <div class="locale-project-contributors-group locale-project-contributors-editors"> 202 <h3>Translation Editors</h3> 203 <?php if ( $locale_contributors['editors'] ) : ?> 204 <ul> 205 <?php 206 foreach ( $locale_contributors['editors'] as $editor ) { 207 printf( 208 '<li><a href="https://profiles.wordpress.org/%s/">%s %s</a></li>', 209 $editor->nicename, 210 get_avatar( $editor->email, 40 ), 211 $editor->display_name ? $editor->display_name : $editor->nicename 212 ); 213 } 214 ?> 215 </ul> 216 <?php else : ?> 217 <p>None, be the first?</p> 218 <?php endif; ?> 219 </div> 236 237 <?php if ( $locale_contributors['editors'] ) : ?> 238 <div class="locale-project-contributors-group locale-project-contributors-editors"> 239 <h3>Translation Editors</h3> 240 <ul> 241 <?php 242 foreach ( $locale_contributors['editors'] as $editor ) { 243 printf( 244 '<li><a href="https://profiles.wordpress.org/%s/">%s %s</a></li>', 245 $editor->nicename, 246 get_avatar( $editor->email, 50 ), 247 $editor->display_name ? $editor->display_name : $editor->nicename 248 ); 249 } 250 ?> 251 </ul> 252 </div> 253 <?php endif; ?> 220 254 </div> 221 255 -
sites/trunk/translate.wordpress.org/public_html/gp-templates-new/style.css
r2663 r2667 1283 1283 } 1284 1284 1285 .locale-project-contributors-group { 1286 width: 50%; 1287 float: left; 1285 @media (min-width: 600px) { 1286 .locale-project-contributors-group { 1287 float: left; 1288 } 1289 1290 .locale-project-contributors-contributors { 1291 width: 65%; 1292 margin-right: 5%; 1293 } 1294 1295 .locale-project-contributors-editors { 1296 width: 30%; 1297 } 1288 1298 } 1289 1299 … … 1298 1308 } 1299 1309 1300 .locale-project-contributors-group li img{1310 .locale-project-contributors-group .avatar { 1301 1311 vertical-align: middle; 1302 1312 margin-right: 10px; 1303 1313 } 1314 1315 .locale-project-contributors-table { 1316 width: 100%; 1317 } 1318 1319 .locale-project-contributors-table .contributor-name { 1320 width: 40%; 1321 } 1322 1323 .locale-project-contributors-table .contributor-name span { 1324 font-size: 11px; 1325 display: block; 1326 } 1327 1328 .locale-project-contributors-table tr { 1329 vertical-align: top; 1330 } 1331 1332 .locale-project-contributors-table th { 1333 font-weight: bold; 1334 border-bottom: 1px solid #eee; 1335 } 1336 1337 .locale-project-contributors-table th.contributor-stats { 1338 text-align: center; 1339 } 1340 1341 .locale-project-contributors-table td.contributor-stats div { 1342 text-align: center; 1343 width: 25%; 1344 float: left; 1345 } 1346 1347 .locale-project-contributors-table td.contributor-stats div span { 1348 text-transform: uppercase; 1349 font-size: 10px; 1350 } 1351 1352 .locale-project-contributors-table td.contributor-stats div.current span { 1353 color: #6bc373; 1354 } 1355 1356 .locale-project-contributors-table td.contributor-stats div.waiting span { 1357 color: #ffc733; 1358 } 1359 1360 .locale-project-contributors-table td.contributor-stats div.fuzzy span { 1361 color: #f78b53; 1362 } 1363 1364 .locale-project-contributors-table tbody td { 1365 padding: 10px 0; 1366 border-bottom: 1px solid #eee; 1367 } 1368 1369 .locale-project-contributors-table tbody tr:last-child td { 1370 border-bottom: 0; 1371 } 1372 1373 .locale-project-contributors-contributors .stats-hint { 1374 text-align: right; 1375 font-size: 10px; 1376 } 1377 1378 @media (max-width: 500px) { 1379 .locale-project-contributors-table thead { 1380 display: none; 1381 } 1382 1383 .locale-project-contributors-table tbody td { 1384 width: 100%; 1385 display: block; 1386 } 1387 1388 .locale-project-contributors-table .contributor-name, 1389 .locale-project-contributors-table .contributor-stats { 1390 width: 100%; 1391 border-bottom: 0; 1392 } 1393 1394 .locale-project-contributors-table .contributor-stats:before, 1395 .locale-project-contributors-table .contributor-stats:after { 1396 content: ""; 1397 display: table; 1398 } 1399 1400 .locale-project-contributors-table .contributor-stats:after { 1401 clear: both; 1402 } 1403 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/locale.php
r2663 r2667 335 335 336 336 // Get the names of the contributors. 337 foreach ( $contributors as $contributor _id) {338 if ( isset( $locale_contributors['editors'][ $contributor _id ] ) ) {337 foreach ( $contributors as $contributor ) { 338 if ( isset( $locale_contributors['editors'][ $contributor->user_id ] ) ) { 339 339 continue; 340 340 } 341 341 342 if ( isset( $locale_contributors['contributors'][ $contributor_id ] ) ) { 342 343 if ( isset( $locale_contributors['contributors'][ $contributor->user_id ] ) ) { 344 // Update last updated and counts per status. 345 $locale_contributors['contributors'][ $contributor->user_id ]->last_update = max( 346 $locale_contributors['contributors'][ $contributor->user_id ]->last_update, 347 $contributor->last_update 348 ); 349 350 $locale_contributors['contributors'][ $contributor->user_id ]->total_count += $contributor->total_count; 351 $locale_contributors['contributors'][ $contributor->user_id ]->current_count += $contributor->current_count; 352 $locale_contributors['contributors'][ $contributor->user_id ]->waiting_count += $contributor->waiting_count; 353 $locale_contributors['contributors'][ $contributor->user_id ]->fuzzy_count += $contributor->fuzzy_count; 343 354 continue; 344 355 } 345 356 346 $user = get_user_by( 'id', $contributor _id );357 $user = get_user_by( 'id', $contributor->user_id ); 347 358 if ( ! $user ) { 348 359 continue; 349 360 } 350 361 351 $locale_contributors['contributors'][ $contributor_id ] = (object) array( 352 'nicename' => $user->user_nicename, 353 'display_name' => $this->_encode( $user->display_name ), 354 'email' => $user->user_email, 362 $locale_contributors['contributors'][ $contributor->user_id ] = (object) array( 363 'nicename' => $user->user_nicename, 364 'display_name' => $this->_encode( $user->display_name ), 365 'email' => $user->user_email, 366 'last_update' => $contributor->last_update, 367 'total_count' => $contributor->total_count, 368 'current_count' => $contributor->current_count, 369 'waiting_count' => $contributor->waiting_count, 370 'fuzzy_count' => $contributor->fuzzy_count, 355 371 ); 356 372 } 357 373 unset( $contributors ); 374 375 uasort( $locale_contributors['contributors'], array( $this, '_sort_contributors_by_total_count_callback' ) ); 358 376 359 377 return $locale_contributors; … … 369 387 global $wpdb; 370 388 371 $user_ids = $wpdb->get_col( $wpdb->prepare( " 372 SELECT DISTINCT( `user_id` ) 389 $contributors = $wpdb->get_results( $wpdb->prepare( " 390 SELECT 391 `user_id`, 392 MAX( `date_added` ) AS `last_update`, 393 COUNT( * ) as `total_count`, 394 COUNT( CASE WHEN `status` = 'current' THEN `status` END ) AS `current_count`, 395 COUNT( CASE WHEN `status` = 'waiting' THEN `status` END ) AS `waiting_count`, 396 COUNT( CASE WHEN `status` = 'fuzzy' THEN `status` END ) AS `fuzzy_count` 373 397 FROM `{$wpdb->gp_translations}` 374 398 WHERE 375 399 `translation_set_id` = %d 376 400 AND `user_id` IS NOT NULL AND `user_id` != 0 377 AND `status` <> 'rejected'401 AND `status` IN( 'current', 'waiting', 'fuzzy' ) 378 402 AND `date_modified` > %s 403 GROUP BY `user_id` 379 404 ", $translation_set->id, date( 'Y-m-d', time() - YEAR_IN_SECONDS ) ) ); 380 405 381 return $ user_ids;406 return $contributors; 382 407 } 383 408 … … 731 756 } 732 757 758 private function _sort_contributors_by_total_count_callback( $a, $b ) { 759 return $a->total_count < $b->total_count; 760 } 761 733 762 private function _sort_reverse_name_callback( $a, $b ) { 734 763 // The Waiting project should always be first.
Note: See TracChangeset
for help on using the changeset viewer.