Making WordPress.org

Changeset 3427


Ignore:
Timestamp:
06/18/2016 12:33:56 PM (9 years ago)
Author:
obenland
Message:

Plugin Directory: Second pass at plugin reviews o plugin detail.

See #1719.`

Location:
sites/trunk/wordpress.org/public_html/wp-content
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php

    r3420 r3427  
    4343            global $wpdb;
    4444
    45             $reviews = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM ratings WHERE object_type = 'plugin' AND object_slug = %s ORDER BY review_id DESC LIMIT 2", $plugin_slug ) );
     45            $reviews = $wpdb->get_results( $wpdb->prepare( "
     46            SELECT posts.post_text AS post_content, topics.topic_title AS post_title, ratings.rating AS post_rating, ratings.user_id AS post_author
     47            FROM ratings
     48                INNER JOIN minibb_topics AS topics ON ( ratings.review_id = topics.topic_id )
     49                INNER JOIN minibb_posts AS posts ON ( ratings.review_id = posts.topic_id )
     50            WHERE
     51                ratings.object_type = 'plugin' AND
     52                ratings.object_slug = %s AND
     53                posts.post_position = 1
     54            ORDER BY ratings.review_id DESC LIMIT 2", $plugin_slug ) );
    4655            wp_cache_set( "{$plugin_slug}_reviews", $reviews, 'wporg-plugins', HOUR_IN_SECONDS );
    4756        }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-reviews.php

    r3420 r3427  
    1515     */
    1616    static function display() {
    17         $post    = get_post();
    18         $reviews = array(); //Tools::get_plugin_reviews( $post->post_name );
     17        $reviews = Tools::get_plugin_reviews( get_post()->post_name );
    1918
    2019        if ( empty( $reviews ) ) {
     
    2524        ?>
    2625
    27         <ul class="plugin-reviews">
     26        <div class="plugin-reviews">
    2827            <?php
    2928            foreach ( $reviews as $review ) :
    30                 $reviewer = get_user_by( 'id', $review->user_id );
     29                $reviewer = get_user_by( 'id', $review->post_author );
    3130                if ( ! $reviewer ) :
    3231                    continue;
    3332                endif;
    3433                ?>
    35                 <li>
    36                     <article class="plugin-review">
    37                         <div class="review-avatar"><?php echo get_avatar( $reviewer->ID, 32 ); ?></div>
    38                         <div class="review">
    39                             <header>
    40                                 <h3><?php echo $review->topic_ctitle; ?></h3>
    41                                 <?php echo Template::dashicons_stars( $review->rating ); ?>
    42                                 <span class="byline"><?php printf( esc_html_x( 'By %s', 'post author', 'wporg-plugins' ), '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( Template::encode( get_the_author() ) ) . '</a></span>' ); ?></span>
    43                             </header>
    44                             <div class="review-content"><?php echo $review->topic_text; ?></div>
    45                         </div>
    46                     </article>
    47                 </li>
     34                <article class="plugin-review">
     35                    <div class="review-avatar">
     36                        <?php echo get_avatar( $reviewer->ID, 60 ); ?>
     37                    </div><div class="review">
     38                        <header>
     39                            <h3 class="review-title"><?php echo $review->post_title; ?></h3>
     40                            <?php echo Template::dashicons_stars( $review->post_rating ); ?>
     41                            <span class="review-author author vcard"><a class="url fn n" href="<?php esc_url( get_author_posts_url( $reviewer->ID ) ); ?>"><?php echo Template::encode( $reviewer->display_name ); ?></a></span>
     42                        </header>
     43                        <p class="review-content"><?php echo $review->post_content; ?></p>
     44                    </div>
     45                </article>
    4846            <?php endforeach; ?>
    49         </ul>
     47        </div>
    5048
    5149        <?php
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/css/style-rtl.css

    r3424 r3427  
    21682168  font-weight: 600;
    21692169  padding: 0;
     2170  text-transform: inherit;
    21702171}
    21712172
     
    21962197}
    21972198
     2199.single .type-plugin .entry-content .reviews-link {
     2200  font-size: 12.8px;
     2201  font-size: 0.8rem;
     2202  margin-top: 0.5rem;
     2203  position: relative;
     2204}
     2205
     2206.single .type-plugin .entry-content .reviews-link:after {
     2207  content: "\f341";
     2208  font-family: dashicons;
     2209  padding-right: 5px;
     2210  vertical-align: text-top;
     2211}
     2212
    21982213.single .type-plugin .entry-content .plugin-screenshots {
    21992214  list-style-type: none;
     
    22042219.single .type-plugin .entry-content .plugin-screenshots figcaption {
    22052220  font-style: italic;
     2221}
     2222
     2223.single .type-plugin .entry-content .plugin-reviews {
     2224  list-style-type: none;
     2225  margin: 0;
     2226  padding: 0;
     2227}
     2228
     2229.single .type-plugin .entry-content .plugin-reviews .plugin-review + .plugin-review {
     2230  margin: 32px 0 16px;
     2231  margin: 2rem 0 1rem;
     2232}
     2233
     2234.single .type-plugin .entry-content .plugin-reviews .review-avatar {
     2235  display: none;
     2236}
     2237
     2238.single .type-plugin .entry-content .plugin-reviews .review,
     2239.single .type-plugin .entry-content .plugin-reviews .wporg-ratings,
     2240.single .type-plugin .entry-content .plugin-reviews .review-author {
     2241  display: inline-block;
     2242  vertical-align: top;
     2243}
     2244
     2245.single .type-plugin .entry-content .plugin-reviews .review-header {
     2246  margin: 0 0 8px;
     2247  margin: 0 0 0.5rem;
     2248}
     2249
     2250.single .type-plugin .entry-content .plugin-reviews .review-title {
     2251  font-size: 16px;
     2252  font-size: 1rem;
     2253  font-weight: 600;
     2254  letter-spacing: 0.01rem;
     2255  margin: 0 0 8px;
     2256  margin: 0 0 0.5rem;
     2257  text-transform: uppercase;
     2258}
     2259
     2260.single .type-plugin .entry-content .plugin-reviews .review-author {
     2261  line-height: 1.25;
     2262  margin-right: 10px;
     2263}
     2264
     2265@media screen and (min-width: 48em) {
     2266  .single .type-plugin .entry-content .plugin-reviews .review-avatar {
     2267    display: inline-block;
     2268    vertical-align: top;
     2269  }
     2270  .single .type-plugin .entry-content .plugin-reviews .review-avatar .avatar {
     2271    margin-left: 16px;
     2272    margin-left: 1rem;
     2273  }
     2274  .single .type-plugin .entry-content .plugin-reviews .review {
     2275    width: calc(100% - 60px - 1rem);
     2276  }
     2277  .single .type-plugin .entry-content .plugin-reviews .review-header {
     2278    margin: 0;
     2279  }
     2280  .single .type-plugin .entry-content .plugin-reviews .review-author {
     2281    line-height: 1;
     2282  }
    22062283}
    22072284
     
    22222299}
    22232300
    2224 .single .type-plugin .entry-content .plugin-developers .avatar {
     2301.single .type-plugin .entry-content .avatar {
    22252302  border-radius: 50%;
    22262303  margin-left: 10px;
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/css/style.css

    r3424 r3427  
    21682168  font-weight: 600;
    21692169  padding: 0;
     2170  text-transform: inherit;
    21702171}
    21712172
     
    21962197}
    21972198
     2199.single .type-plugin .entry-content .reviews-link {
     2200  font-size: 12.8px;
     2201  font-size: 0.8rem;
     2202  margin-top: 0.5rem;
     2203  position: relative;
     2204}
     2205
     2206.single .type-plugin .entry-content .reviews-link:after {
     2207  content: "\f345";
     2208  font-family: dashicons;
     2209  padding-left: 5px;
     2210  vertical-align: text-top;
     2211}
     2212
    21982213.single .type-plugin .entry-content .plugin-screenshots {
    21992214  list-style-type: none;
     
    22042219.single .type-plugin .entry-content .plugin-screenshots figcaption {
    22052220  font-style: italic;
     2221}
     2222
     2223.single .type-plugin .entry-content .plugin-reviews {
     2224  list-style-type: none;
     2225  margin: 0;
     2226  padding: 0;
     2227}
     2228
     2229.single .type-plugin .entry-content .plugin-reviews .plugin-review + .plugin-review {
     2230  margin: 32px 0 16px;
     2231  margin: 2rem 0 1rem;
     2232}
     2233
     2234.single .type-plugin .entry-content .plugin-reviews .review-avatar {
     2235  display: none;
     2236}
     2237
     2238.single .type-plugin .entry-content .plugin-reviews .review,
     2239.single .type-plugin .entry-content .plugin-reviews .wporg-ratings,
     2240.single .type-plugin .entry-content .plugin-reviews .review-author {
     2241  display: inline-block;
     2242  vertical-align: top;
     2243}
     2244
     2245.single .type-plugin .entry-content .plugin-reviews .review-header {
     2246  margin: 0 0 8px;
     2247  margin: 0 0 0.5rem;
     2248}
     2249
     2250.single .type-plugin .entry-content .plugin-reviews .review-title {
     2251  font-size: 16px;
     2252  font-size: 1rem;
     2253  font-weight: 600;
     2254  letter-spacing: 0.01rem;
     2255  margin: 0 0 8px;
     2256  margin: 0 0 0.5rem;
     2257  text-transform: uppercase;
     2258}
     2259
     2260.single .type-plugin .entry-content .plugin-reviews .review-author {
     2261  line-height: 1.25;
     2262  margin-left: 10px;
     2263}
     2264
     2265@media screen and (min-width: 48em) {
     2266  .single .type-plugin .entry-content .plugin-reviews .review-avatar {
     2267    display: inline-block;
     2268    vertical-align: top;
     2269  }
     2270  .single .type-plugin .entry-content .plugin-reviews .review-avatar .avatar {
     2271    margin-right: 16px;
     2272    margin-right: 1rem;
     2273  }
     2274  .single .type-plugin .entry-content .plugin-reviews .review {
     2275    width: calc(100% - 60px - 1rem);
     2276  }
     2277  .single .type-plugin .entry-content .plugin-reviews .review-header {
     2278    margin: 0;
     2279  }
     2280  .single .type-plugin .entry-content .plugin-reviews .review-author {
     2281    line-height: 1;
     2282  }
    22062283}
    22072284
     
    22222299}
    22232300
    2224 .single .type-plugin .entry-content .plugin-developers .avatar {
     2301.single .type-plugin .entry-content .avatar {
    22252302  border-radius: 50%;
    22262303  margin-right: 10px;
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/sass/site/primary/_plugin-single.scss

    r3423 r3427  
    109109                font-weight: 600;
    110110                padding: 0;
     111                text-transform: inherit;
    111112            }
    112113
     
    138139        }
    139140
     141        .reviews-link {
     142            @include font-size( ms-unitless( ms(-2) ) );
     143            margin-top: 0.5rem;
     144            position: relative;
     145
     146            &:after {
     147                content: "\f345";
     148                font-family: dashicons;
     149                padding-left: 5px;
     150                vertical-align: text-top;
     151            }
     152        }
     153
    140154        .plugin-screenshots {
    141155            list-style-type: none;
     
    145159            figcaption {
    146160                font-style: italic;
     161            }
     162        }
     163
     164        .plugin-reviews {
     165            list-style-type: none;
     166            margin: 0;
     167            padding: 0;
     168
     169            .plugin-review + .plugin-review {
     170                margin: 32px 0 16px;
     171                margin: 2rem 0 1rem;
     172            }
     173
     174            .review-avatar {
     175                display: none;
     176            }
     177
     178            .review,
     179            .wporg-ratings,
     180            .review-author {
     181                display: inline-block;
     182                vertical-align: top;
     183            }
     184
     185            .review-header {
     186                margin: 0 0 8px;
     187                margin: 0 0 0.5rem;
     188            }
     189
     190            .review-title {
     191                @include font-size( ms-unitless( ms(0) ) );
     192                font-weight: 600;
     193                letter-spacing: 0.01rem;
     194                margin: 0 0 8px;
     195                margin: 0 0 0.5rem;
     196                text-transform: uppercase;
     197            }
     198
     199            .review-author {
     200                line-height: 1.25;
     201                margin-left: 10px;
     202            }
     203
     204            @media screen and ( min-width: $ms-breakpoint ) {
     205                .review-avatar {
     206                    display: inline-block;
     207                    vertical-align: top;
     208
     209                    .avatar {
     210                        margin-right: 16px;
     211                        margin-right: 1rem;
     212                    }
     213                }
     214
     215                .review {
     216                    width: calc(100% - 60px - 1rem);
     217                }
     218
     219                .review-header {
     220                    margin: 0;
     221                }
     222
     223                .review-author {
     224                    line-height: 1;
     225                }
    147226            }
    148227        }
     
    162241                }
    163242            }
    164 
    165             .avatar {
    166                 border-radius: 50%;
    167                 margin-right: 10px;
    168                 vertical-align: middle;
    169             }
    170         }
    171     }
     243        }
     244
     245        .avatar {
     246            border-radius: 50%;
     247            margin-right: 10px;
     248            vertical-align: middle;
     249        }
     250    }
     251
    172252    @media screen and ( min-width: $ms-breakpoint ) {
    173253        .entry-meta {
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php

    r3422 r3427  
    6161                <?php echo $section_content; ?>
    6262            </div>
     63                <?php if ( 'reviews' === $section_slug ) : ?>
     64                <a class="reviews-link" href="<?php echo esc_url( 'https://wordpress.org/support/view/plugin-reviews/' . get_post()->post_name . '/' ); ?>">
     65                    <?php printf( __( 'Read all %s reviews', 'wporg-plugins' ), get_post_meta( get_the_ID(), 'num_ratings', true ) ); ?>
     66                </a>
     67                <?php else : ?>
    6368            <button type="button" class="button-link section-toggle" aria-controls="<?php echo esc_attr( $section_slug ); ?>"><?php _e( 'Read more', 'wporg-plugins' ); ?></button>
     69                <?php endif; ?>
    6470        <?php endforeach; ?>
    6571    </div><!-- .entry-content -->
Note: See TracChangeset for help on using the changeset viewer.