Making WordPress.org

Changeset 4278


Ignore:
Timestamp:
10/21/2016 05:57:46 AM (8 years ago)
Author:
dd32
Message:

Plugin Directory: Add some basic Committer/Contributor widgets for the plugin "admin" view.

See #2111

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

Legend:

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

    r4223 r4278  
    1818
    1919        if ( $contributors = get_the_terms( $post->ID, 'plugin_contributors' ) ) {
    20             $contributors = wp_list_pluck( $contributors, 'slug' );
     20            $contributors = wp_list_pluck( $contributors, 'name' );
    2121        } else {
    2222            $contributors = array();
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-committers.php

    r4263 r4278  
    22namespace WordPressdotorg\Plugin_Directory\Widgets;
    33use WordPressdotorg\Plugin_Directory\Template;
     4use WordPressdotorg\Plugin_Directory\Tools;
    45
    56/**
     
    2930        $post = get_post();
    3031
     32        $committers = Tools::get_plugin_committers( $post->post_name );
     33        $committers = array_map( function( $user_login ) {
     34            return get_user_by( 'login', $user_login );
     35        }, $committers );
     36
    3137        echo $args['before_widget'];
    3238        ?>
     39        <style>
     40            <?php // TODO: Yes, these need to be moved into the CSS somewhere. ?>
     41            h3 a.addnew:before {
     42                content: '+';
     43            }
     44            ul.committer-list {
     45                list-style: none;
     46                margin: 0;
     47                font-size: 0.9em;
     48            }
     49            ul.committer-list li {
     50                clear: both;
     51                padding-bottom: 0.5em;
     52            }
     53            ul.committer-list a.remove {
     54                color: red;
     55                visibility: hidden;
     56            }
     57            ul.committer-list li:hover a.remove {
     58                visibility: visible;
     59            }
     60        </style>
     61        <h3><?php _e( 'Committers', 'wporg-plugins' ); ?> <a href="#" class="addnew"><?php _e( 'Add', 'wporg-plugins' ); ?></button></h3>
    3362
    34         <h3 class="screen-reader-text"><?php echo apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Committers', 'wporg-plugins' ) : $instance['title'], $instance, $this->id_base ); ?></h3>
     63        <ul class="committer-list">
     64        <?php foreach ( $committers as $committer ) {
     65            echo '<li>' .
     66                get_avatar( $committer->ID, 32 ) .
     67                '<a href="' . esc_url( 'https://profiles.wordpress.org/' . $committer->user_nicename ) . '">' . Template::encode( $committer->display_name ) . '</a>' .
     68                '<br><small>' . esc_html( $committer->user_email ) . ' ' .
     69                '<a href="#" class="remove">' . __( 'Remove', 'wporg-plugins' ) . '</a>' .
     70                '</small>' .
     71                '</li>';
     72        } ?>
     73        </ul>
    3574
    3675
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-contributors.php

    r4263 r4278  
    2929        $post = get_post();
    3030
     31        $contributors = (array) wp_list_pluck( (array)get_the_terms( $post, 'plugin_contributors' ), 'name' );
     32        $contributors = array_map( function( $user_nicename ) {
     33            return get_user_by( 'slug', $user_nicename );
     34        }, $contributors );
     35
    3136        echo $args['before_widget'];
    3237        ?>
     38        <style>
     39            <?php // TODO: Yes, these need to be moved into the CSS somewhere. ?>
     40            ul.contributors-list {
     41                list-style: none;
     42                margin: 0;
     43                font-size: 0.9em;
     44            }
     45            ul.contributors-list li {
     46                padding-bottom: 0.5em;
     47            }
     48        </style>
     49        <h3><?php _e( 'Contributors', 'wporg-plugins' ); ?></h3>
     50        <p class="widget-subnav"><small><a href="#"><?php _e( 'View the capabilities these users have', 'wporg-plugins' ); ?></a></small></p>
    3351
    34         <h3 class="screen-reader-text"><?php echo apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Committers', 'wporg-plugins' ) : $instance['title'], $instance, $this->id_base ); ?></h3>
    35 
     52        <ul id="contributors-list" class="contributors-list read-more" aria-expanded="false">
     53        <?php foreach ( $contributors as $contributor ) {
     54            echo '<li>' . get_avatar( $contributor->ID, 32 ) . '<a href="' . esc_url( 'https://profiles.wordpress.org/' . $contributor->user_nicename ) . '">' . Template::encode( $contributor->display_name ) . '</a></li>';
     55        } ?>
     56        </ul>
     57        <button type="button" class="button-link section-toggle" aria-controls="contributors-list"><?php _e( 'View more', 'wporg-plugins' ); ?></button>
    3658
    3759        <?php
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-plugin-review.php

    r4263 r4278  
    3232        ?>
    3333
    34         <h3 class="screen-reader-text"><?php echo apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Committers', 'wporg-plugins' ) : $instance['title'], $instance, $this->id_base ); ?></h3>
     34        <h3><?php _e( 'Plugin Review', 'wporg-plugins' ); ?></h3>
    3535
    3636
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/client/styles/modules/_accessibility.scss

    r4223 r4278  
    3131    outline: 0;
    3232}
     33
     34/* hide elements if JS isn't available. */
     35.no-js .hide-if-no-js {
     36    display: none;
     37}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/css/style-rtl.css

    r4263 r4278  
    13731373#content[tabindex="-1"]:focus {
    13741374  outline: 0;
     1375}
     1376
     1377/* hide elements if JS isn't available. */
     1378.no-js .hide-if-no-js {
     1379  display: none;
    13751380}
    13761381
     
    22002205
    22012206.no-js .plugin-faqs dd {
    2202     display: block;
     2207  display: block;
    22032208}
    22042209
     
    24742479}
    24752480
    2476 .no-js .read-more,
    24772481.read-more#reviews {
    24782482  max-height: none;
     
    25242528}
    25252529
     2530.no-js .read-more {
     2531  overflow: auto;
     2532  max-height: none;
     2533}
     2534
    25262535.section-toggle {
    25272536  color: #0073aa;
     
    25462555
    25472556.no-js .section-toggle {
    2548     display: none;
     2557  display: none;
    25492558}
    25502559
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/css/style.css

    r4263 r4278  
    13731373#content[tabindex="-1"]:focus {
    13741374  outline: 0;
     1375}
     1376
     1377/* hide elements if JS isn't available. */
     1378.no-js .hide-if-no-js {
     1379  display: none;
    13751380}
    13761381
     
    22002205
    22012206.no-js .plugin-faqs dd {
    2202     display: block;
     2207  display: block;
    22032208}
    22042209
     
    24742479}
    24752480
    2476 .no-js .read-more,
    24772481.read-more#reviews {
    24782482  max-height: none;
     
    25242528}
    25252529
     2530.no-js .read-more {
     2531  overflow: auto;
     2532  max-height: none;
     2533}
     2534
    25262535.section-toggle {
    25272536  color: #0073aa;
     
    25462555
    25472556.no-js .section-toggle {
    2548     display: none;
     2557  display: none;
    25492558}
    25502559
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php

    r4263 r4278  
    8686                <?php if ( current_user_can( 'plugin_admin_view', get_post() ) ) : ?>
    8787                    <br>
    88                     <a class="plugin-edit" href="<?php echo esc_url( get_permalink() . 'admin/' ); ?>"><?php _e( 'Edit Plugin', 'wporg-plugins' ); ?></a>
     88                    <a class="plugin-edit hide-if-no-js" href="<?php echo esc_url( get_permalink() . 'admin/' ); ?>"><?php _e( 'Edit Plugin', 'wporg-plugins' ); ?></a>
    8989                <?php endif; ?>
    9090            </div>
Note: See TracChangeset for help on using the changeset viewer.