Making WordPress.org

Changeset 1859


Ignore:
Timestamp:
09/02/2015 10:38:03 PM (8 years ago)
Author:
dd32
Message:

Translate: Stats overview: Update the styles.
Props sam.
See #1202

Location:
sites/trunk/translate.wordpress.org/public_html/gp-templates
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/translate.wordpress.org/public_html/gp-templates/stats-overview.php

    r1852 r1859  
    88gp_tmpl_header();
    99
    10 function get_rgb_for_percent( $percent ) {
    11     // This function does 100% = Green, < 100% = Red~Yellow
    12     if ( $percent == 100 ) {
    13         return 'rgb(0,153,0)';
    14     }
    15     $min = 0;
    16     $max = 153;
    17     $num = floor( $min + ( ($max - $min) * ( $percent/100 ) ) );
    18     return "rgb(153,$num,0)";
    19 }
    2010
    2111?>
    22 <div class="table">
    23     <style>
    24         <?php /* Temporary styling */ ?>
    25         table.table {
    26             text-align: center;
    27         }
    28         table.table thead th {
    29             text-align: center;
    30             font-weight: bold;
    31         }
    32         table.table .none {
    33             color: #ccc;
    34         }
    35         table.table tbody th {
    36             text-align: left;
    37         }
    38     </style>
     12<div class="stats-table">
    3913    <table class="table">
    4014        <thead>
    4115            <tr>
    42                 <th><?php _e( 'Language' ); ?></th>
     16                <th class="title"><?php _e( 'Locale' ); ?></th>
    4317                <?php foreach ( $projects as $slug => $project ) : ?>
    44                     <th><?php echo esc_html( str_replace( 'WordPress.org ', '', $project->name ) ); ?></th>
     18                    <th><?php
     19                        $namereplace = array( 'WordPress.org ', 'WordPress for ', 'WordPress ', 'ectory' );
     20                        echo esc_html( str_replace( $namereplace, '', $project->name ) );
     21                    ?></th>
    4522                <?php endforeach; ?>
    4623            </tr>
    4724        </thead>
    4825        <tbody>
    49             <?php foreach ( $translation_locale_complete as $locale_slug => $total_complete ) :
     26            <?php
     27            foreach ( $translation_locale_complete as $locale_slug => $total_complete ) :
    5028                $gp_locale = GP_Locales::by_slug( $locale_slug );
     29                $set_slug = 'default';
    5130                // Variants (de/formal for example) don't have GP_Locales in this context
     31                if ( ! $gp_locale && ( list( $base_locale_slug, $set_slug ) = explode( '/', $locale_slug ) ) ) {
     32                    $gp_locale = clone GP_Locales::by_slug( $base_locale_slug );
     33                    // Just append it for now..
     34                    $gp_locale->wp_locale .= '/' . $set_slug;
     35                }
     36                if ( ! $gp_locale || ! $gp_locale->wp_locale ) {
     37                    continue;
     38                }
    5239            ?>
    5340                <tr>
    54                     <th title="<?php echo esc_attr( $gp_locale->english_name ?: $locale_slug ); ?>"><?php echo esc_html( $gp_locale->wp_locale ?: $locale_slug ); ?></th>
    55                     <?php foreach ( $projects as $slug => $project ) :
     41                    <th title="<?php echo esc_attr( $gp_locale->english_name ); ?>">
     42                        <a href="<?php echo gp_url_join( 'locale', $gp_locale->slug, $set_slug ); ?>">
     43                            <?php echo esc_html( $gp_locale->wp_locale ); ?>
     44                        </a>
     45                    </th>
     46                    <?php
     47                    foreach ( $projects as $slug => $project ) {
     48                        $projecturl = gp_url_join( 'locale', $gp_locale->slug, $set_slug, $project->path );
     49
    5650                        if ( isset( $translation_locale_statuses[ $locale_slug ][ $project->path ] ) ) {
    5751                            $percent = $translation_locale_statuses[ $locale_slug ][ $project->path ];
    58                             $percent = '<span style="color:' . get_rgb_for_percent( $percent ) . '">' . $percent . '%</span>';
     52
     53                            $percent_class = 'percent' . (int) ( $percent / 10 ) * 10;
     54                            echo '<td class="' . $percent_class .'"><a href="' . $projecturl . '">' . $percent . '%</a></td>';
    5955
    6056                        } else {
    61                             $percent = '<span class="none">&mdash;</span>';
     57                            echo '<td class="none">&mdash;</td>';
    6258                        }
     59                       
     60                       
     61                    }
    6362                    ?>
    64                         <td><?php echo $percent; ?></td>
    65                     <?php endforeach; ?>
    6663                </tr>
    6764            <?php endforeach; ?>
  • sites/trunk/translate.wordpress.org/public_html/gp-templates/style.css

    r1858 r1859  
    869869    }
    870870}
     871
     872.stats-table table.table {
     873    width: 620px;
     874    text-align: center;
     875    border-collapse: collapse;
     876}
     877
     878.stats-table table thead {
     879    border-bottom: 1px solid #191E23;
     880    color: #191E23;
     881    background: white;
     882}
     883.stats-table table thead th {
     884    margin: 0;
     885    font-weight: bold;
     886    text-align: center;
     887    vertical-align: bottom;
     888    width: 60px;
     889    padding-top: 10px;
     890}
     891
     892.stats-table table th.title {
     893    width: 120px;
     894}
     895
     896.stats-table .none {
     897    color: #ccc;
     898}
     899
     900.stats-table tbody th {
     901    text-align: left;
     902    padding: 3px 10px;
     903    background: #eee;
     904}
     905
     906.stats-table tbody tr:hover {
     907    opacity: 0.8;
     908    outline: 1px solid #191E23;
     909    outline-offset: 0;
     910}
     911
     912.stats-table tbody tr th a:link,
     913.stats-table tbody tr th a:hover,
     914.stats-table tbody tr th a:visited {
     915    color: #191E23;
     916}
     917
     918.stats-table tbody td {
     919    padding: 3px 0;
     920}
     921
     922.stats-table tbody td.percent100 {background: #46B450; color: white;}
     923.stats-table tbody td.percent90 {background: #6BC373;}
     924.stats-table tbody td.percent80 {background: #90D296;}
     925.stats-table tbody td.percent70 {background: #B5E1B9;}
     926.stats-table tbody td.percent60 {background: #C7E8CA;}
     927.stats-table tbody td.percent50 {background: #FFE399;}
     928.stats-table tbody td.percent40 {background: #FBC5A9;}
     929.stats-table tbody td.percent30 {background: #F1ADAD;}
     930.stats-table tbody td.percent20 {background: #EA8484;}
     931.stats-table tbody td.percent10 {background: #E35B5B;}
     932.stats-table tbody td.percent0 {background: #DC3232; color: white;}
     933
     934.stats-table tbody td a:link,
     935.stats-table tbody td a:hover,
     936.stats-table tbody td a:visited {
     937    color: #191E23;
     938    display: inline-block;
     939    width: 100%;
     940    height: 100%;
     941}
     942
     943.stats-table tbody td.percent100 a:link,
     944.stats-table tbody td.percent0 a:link,
     945.stats-table tbody td.percent100 a:hover,
     946.stats-table tbody td.percent0 a:hover,
     947.stats-table tbody td.percent100 a:visited,
     948.stats-table tbody td.percent0 a:visited {
     949    color: white;
     950}
     951
     952.stats-table tbody tr td {
     953    vertical-align: middle;
     954}
Note: See TracChangeset for help on using the changeset viewer.