Making WordPress.org


Ignore:
Timestamp:
07/19/2016 07:42:02 PM (9 years ago)
Author:
obenland
Message:

Plugin Directory: Proof of concept React components.

This is pretty much the culmination of me playing around with React for a week,
learning along the way. It's a best of from tutorials, Human Made's
Feelingrestful Theme, and various other inspirations I got along the way.

I'm committing this not with the intention of cementing a way to build a JS
client for the Plugin Directory but much rather open this approach up for tips
and feedback on how to proceed. I'd like to find out if React is even working
for our needs, learn how to get the most out of it for our purposes, and learn
how best to implement it for this project.

To see the React client in action and make changes to it, uncomment the
wp_enqueue_script() line in functions.php that enqueues the client JS file.
Then run npm install and grunt watch from the command line in the theme's
root directory. Please see README.md for further details.

See #1719.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/header.php

    r3456 r3695  
    2525    <a class="skip-link screen-reader-text" href="#main"><?php esc_html_e( 'Skip to content', 'wporg-plugins' ); ?></a>
    2626
    27     <header id="masthead" class="site-header" role="banner">
    28         <div class="site-branding">
    29             <?php if ( is_front_page() && is_home() ) : ?>
    30                 <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php _ex( 'Plugins','Site title', 'wporg-plugins' ); ?></a></h1>
    31             <?php else : ?>
    32                 <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php _ex( 'Plugins','Site title', 'wporg-plugins' ); ?></a></p>
    33             <?php endif; ?>
     27    <div id="content" class="site-content">
     28        <header id="masthead" class="site-header" role="banner">
     29            <div class="site-branding">
     30                <?php if ( is_front_page() && is_home() ) : ?>
     31                    <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php _ex( 'Plugins','Site title', 'wporg-plugins' ); ?></a></h1>
     32                <?php else : ?>
     33                    <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php _ex( 'Plugins','Site title', 'wporg-plugins' ); ?></a></p>
     34                <?php endif; ?>
    3435
    35             <?php if ( is_home() ) : ?>
    36                 <p class="site-description">
    37                     <?php
    38                     /* Translators: Total number of plugins. */
    39                     printf( __( 'Extend your WordPress experience with %s plugins.', 'wporg-plugins' ), number_format_i18n( wp_count_posts( 'plugin' )->publish ) );
    40                     ?>
    41                 </p>
    42                 <?php get_search_form(); ?>
    43             <?php else : ?>
    44                 <nav id="site-navigation" class="main-navigation" role="navigation">
    45                     <button class="menu-toggle dashicons dashicons-arrow-down-alt2" aria-controls="primary-menu" aria-expanded="false" aria-label="<?php esc_attr_e( 'Primary Menu', 'wporg-plugins' ); ?>"></button>
    46                     <div id="primary-menu" class="menu">
    47                         <ul>
    48                             <?php
    49                             foreach ( $menu_items as $path => $text ) :
    50                                 $class = false !== strpos( $_SERVER['REQUEST_URI'], $path ) ? 'class="active" ' : '';
    51                             ?>
    52                             <li class="page_item"><a <?php echo $class; ?>href="<?php echo esc_url( home_url( $path ) ); ?>"><?php echo esc_html( $text ); ?></a></li>
    53                             <?php endforeach; ?>
    54                             <li><?php get_search_form(); ?></li>
    55                         </ul>
    56                     </div>
    57                 </nav><!-- #site-navigation -->
    58             <?php endif; ?>
    59         </div><!-- .site-branding -->
    60     </header><!-- #masthead -->
    61 
    62     <div id="content" class="site-content">
     36                <?php if ( is_home() ) : ?>
     37                    <p class="site-description">
     38                        <?php
     39                        /* Translators: Total number of plugins. */
     40                        printf( __( 'Extend your WordPress experience with %s plugins.', 'wporg-plugins' ), number_format_i18n( wp_count_posts( 'plugin' )->publish ) );
     41                        ?>
     42                    </p>
     43                    <?php get_search_form(); ?>
     44                <?php else : ?>
     45                    <nav id="site-navigation" class="main-navigation" role="navigation">
     46                        <button class="menu-toggle dashicons dashicons-arrow-down-alt2" aria-controls="primary-menu" aria-expanded="false" aria-label="<?php esc_attr_e( 'Primary Menu', 'wporg-plugins' ); ?>"></button>
     47                        <div id="primary-menu" class="menu">
     48                            <ul>
     49                                <?php
     50                                foreach ( $menu_items as $path => $text ) :
     51                                    $class = false !== strpos( $_SERVER['REQUEST_URI'], $path ) ? 'class="active" ' : '';
     52                                ?>
     53                                <li class="page_item"><a <?php echo $class; ?>href="<?php echo esc_url( home_url( $path ) ); ?>"><?php echo esc_html( $text ); ?></a></li>
     54                                <?php endforeach; ?>
     55                                <li><?php get_search_form(); ?></li>
     56                            </ul>
     57                        </div>
     58                    </nav><!-- #site-navigation -->
     59                <?php endif; ?>
     60            </div><!-- .site-branding -->
     61        </header><!-- #masthead -->
Note: See TracChangeset for help on using the changeset viewer.