WordPress.org

Making WordPress.org


Ignore:
Timestamp:
12/02/2014 11:03:33 PM (6 years ago)
Author:
obenland
Message:

WP.org Themes: First pass at improved single theme page.

  • Synchronizes content between modal and single view.
  • Displays a banner if the theme is outdated.
  • Removes unused inline CSS for easier code scanning.

See #745.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/view-templates/theme-single.php

    r1009 r1021  
    88        </div>
    99        <div class="theme-about">
     10            <# if ( data.is_outdated ) { #>
     11            <div class="theme-notice notice notice-warning">
     12                <p><?php _e( 'This theme <strong>hasn&#146;t been updated in over 2 years</strong>. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.', 'wporg-themes' ); ?></p>
     13            </div><!-- .theme-notice -->
     14            <# } #>
     15
    1016            <div class="theme-info hentry">
    1117                <h3 class="theme-name entry-title">{{{ data.name }}}</h3>
    12                 <span class="theme-version"><?php printf( __( 'Version: %s' ), '{{{ data.version }}}' ); ?></span>
     18                <span class="theme-version">
     19                    <?php printf( __( 'Version: %s' ), sprintf( '<abbr title="%1$s">%2$s</abbr>', esc_attr( sprintf( __( 'Last updated: %s' ), '{{ new Date(data.last_updated).toLocaleDateString() }}' ) ), '{{{ data.version }}}' ) ); ?>
     20                </span>
    1321                <h4 class="theme-author"><?php printf( __( 'By %s' ), '<span class="author">{{{ data.author }}}</span>' ); ?></h4>
    1422
    1523                <p class="theme-description entry-summary">{{{ data.description }}}</p>
    1624
    17                 <div class="rating rating-{{ Math.round( data.rating / 10 ) * 10 }}">
    18                     <span class="one"></span>
    19                     <span class="two"></span>
    20                     <span class="three"></span>
    21                     <span class="four"></span>
    22                     <span class="five"></span>
    23 
    24                     <p class="votes"><?php printf( __( 'Based on %s ratings.' ), '{{{ data.num_ratings }}}' ); ?></p>
    25                 </div>
    26 
    27                 <div class="theme-stats">
    28                     <div><strong><?php _e( 'Last updated:' ); ?></strong> <span class="updated">{{ data.last_updated }}</span></div>
    29                     <div><strong><?php _e( 'Downloads:' ); ?></strong> {{ data.downloaded }}</div>
    30                     <div><a href="{{ data.homepage }}"><?php _e( 'Theme Homepage &raquo;' ); ?></a></div>
    31                 </div>
     25                <# if ( data.parent ) { #>
     26                    <p class="parent-theme"><?php printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' ); ?></p>
     27                <# } #>
    3228
    3329                <# if ( data.tags ) { #>
     
    4945            </div><!-- .theme-screenshot -->
    5046
    51             <div class="theme-downloads">
    52                 <h4><?php _e( 'Downloads Per Day' ); ?></h4>
    53                 <div id="theme-download-stats-{{data.id}}" class="chart"></div>
    54             </div>
     47            <div class="theme-ratings" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
     48                <meta itemprop="ratingValue" content="{{ (data.rating/20).toFixed(1) }}"/>
     49                <meta itemprop="ratingCount" content="{{ data.num_ratings }}"/>
     50                <h4><?php _e( 'Ratings', 'wporg-themes' ); ?></h4>
     51                <div class="star-holder">
     52                    <div class="star-rating" style="width: {{ (data.rating).toFixed(1) }}%"><?php printf( __( '%d stars', 'wporg-themes' ), '{{ Math.round( data.rating ) }}' ); ?></div>
     53                </div>
     54                <span><?php printf( __( '%s out of 5 stars.', 'wporg-themes' ), '{{ (data.rating/20).toFixed(1) }}' ); ?></span>
     55                <?php
     56                $ratingcount = array(); // TODO: Rating counts
     57                foreach ( range( 1, 5 ) as $val ) {
     58                    if ( empty( $ratingcount[ $val ] ) ) {
     59                        $ratingcount[ $val ] = 0;
     60                    }
     61                }
     62                krsort( $ratingcount );
     63                foreach ( $ratingcount as $key => $ratecount ) :
     64                    ?>
     65                    <div class="counter-container">
     66                        <a href="//wordpress.org/support/view/theme-reviews/{{ data.id }}?filter=<?php echo $key; ?>" title="<?php printf( _n( 'Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key, 'wporg-themes' ), $key ); ?>">
     67                            <span class="counter-label" style="float:left; margin-right:5px;"><?php printf( __( '%d stars', 'wporg-themes' ), $key ); ?></span>
     68                        <span class="counter-back" style="height:17px;width:92px;background-color:#ececec;float:left;">
     69                            <span class="counter-bar" style="width: <?php echo 92 * ( $ratecount / count( 1 ) ); ?>px;height:17px;background-color:#fddb5a;float:left;"></span>
     70                        </span>
     71                        </a>
     72                        <span class="counter-count" style="margin-left:5px;"><?php echo $ratecount; ?></span>
     73                    </div>
     74                <?php endforeach; ?>
     75            </div><!-- .theme-rating -->
    5576
    5677            <div class="theme-devs">
     
    6889                <h5><?php _e( 'Browse the Code', 'wporg-themes' ); ?></h5>
    6990                <ul class="unmarked-list">
    70                     <li><a href='//themes.trac.wordpress.org/log/{{data.id}}/' rel='nofollow'><?php _e( 'Development Log', 'wporg-themes' ); ?></a></li>
    71                     <li><a href='//themes.svn.wordpress.org/{{data.id}}/' rel='nofollow'><?php _e( 'Subversion Repository', 'wporg-themes' ); ?></a></li>
    72                     <li><a href='//themes.trac.wordpress.org/browser/{{data.id}}/' rel='nofollow'><?php _e( 'Browse in Trac', 'wporg-themes' ); ?></a></li>
     91                    <li><a href="//themes.trac.wordpress.org/log/{{data.id}}/" rel="nofollow"><?php _e( 'Development Log', 'wporg-themes' ); ?></a></li>
     92                    <li><a href="//themes.svn.wordpress.org/{{data.id}}/" rel="nofollow"><?php _e( 'Subversion Repository', 'wporg-themes' ); ?></a></li>
     93                    <li><a href="//themes.trac.wordpress.org/browser/{{data.id}}/" rel="nofollow"><?php _e( 'Browse in Trac', 'wporg-themes' ); ?></a></li>
    7394                </ul>
    74             </div>
     95            </div><!-- .theme-devs -->
     96
     97            <div class="theme-downloads">
     98                <h4><?php _e( 'Downloads Per Day' ); ?></h4>
     99                <div id="theme-download-stats-{{data.id}}" class="chart"></div>
     100            </div><!-- .theme-downloads -->
    75101        </div>
    76102
Note: See TracChangeset for help on using the changeset viewer.