Making WordPress.org


Ignore:
Timestamp:
08/09/2016 06:58:20 PM (8 years ago)
Author:
obenland
Message:

Plugin Directory: Show UI to favorite plugins.

Fills in transition animation and enables UI.

Fixes #1811.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php

    r3570 r3791  
    3535
    3636        <div class="plugin-actions">
    37 
    3837            <?php
    39             if ( false && is_user_logged_in() ) { // Hide Favorites until it's styled properly.
     38            if ( is_user_logged_in() ) :
    4039                $url = Template::get_favourite_link( $post );
    41                 echo '<a href="' . esc_url( $url ) . '" class="plugin-favorite-heart' . (Tools::favorited_plugin( $post ) ? ' favorited' : '' ) . '" onclick="jQuery(this).toggleClass(\'favorited\')"></a>';
    42             }
    43             ?>
     40                ?>
     41                <div class="plugin-favorite">
     42                    <a href="<?php echo esc_url( $url ); ?>" class="plugin-favorite-heart<?php echo Tools::favorited_plugin( $post ) ? ' favorited' : ''; ?>"></a>
     43                    <script>
     44                        jQuery( '.plugin-favorite-heart' )
     45                            .on( 'click touchstart animationend', function() {
     46                                jQuery( this ).toggleClass( 'is-animating' );
     47                            } )
     48                            .on( 'click', function() {
     49                                jQuery( this ).toggleClass( 'favorited' );
     50                            } );
     51                    </script>
     52                </div>
     53            <?php endif; ?>
    4454
    4555            <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>" itemprop="downloadUrl"><?php _e( 'Download', 'wporg-plugins' ); ?></a>
Note: See TracChangeset for help on using the changeset viewer.