Skip to:
Content

BuddyPress.org

Changeset 4668


Ignore:
Timestamp:
07/17/2011 05:39:42 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Tweak the activity stream styling - remove faux-buttons and replace with links. Fix bp_dtheme_new_activity_comment() so that it uses the activity/comment.php template rather than being hardcoded into the function.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-template.php

    r4646 r4668  
    708708        // Insert the permalink
    709709        if ( !bp_is_single_activity() )
    710             $content .= apply_filters_ref_array( 'bp_activity_permalink', array( sprintf( ' about <a href="%1$s" class="view" title="%2$s">%3$s</a>', bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ), esc_attr__( 'View Discussion', 'buddypress' ), $time_since ), &$activities_template->activity ) );
     710            $content = apply_filters_ref_array( 'bp_activity_permalink', array( sprintf( '%1$s <a href="%2$s" class="view" title="%3$s">%4$s</a>', $content, bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ), esc_attr__( 'View Discussion', 'buddypress' ), $time_since ), &$activities_template->activity ) );
    711711        else
    712712            $content .= $time_since;
    713 
    714         if ( is_user_logged_in() && bp_activity_can_comment() )
    715             $content .= sprintf( '<a href="%1$s" class="acomment-reply bp-primary-action" id="acomment-comment-%2$d">%3$s</a>', bp_get_activity_comment_link(), bp_get_activity_id(), sprintf( __( 'Reply (<span>%s</span>)', 'buddypress' ), bp_activity_get_comment_count() ) );
    716713
    717714        return apply_filters( 'bp_insert_activity_meta', $content );
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r4648 r4668  
    178178    global $bp;
    179179
    180     /* Check the nonce */
     180    // Check the nonce
    181181    check_admin_referer( 'new_activity_comment', '_wpnonce_new_activity_comment' );
    182182
     
    198198    $comment_id = bp_activity_new_comment( array(
    199199        'activity_id' => $_POST['form_id'],
    200         'content' => $_POST['content'],
    201         'parent_id' => $_POST['comment_id']
    202     ));
     200        'content'     => $_POST['content'],
     201        'parent_id'   => $_POST['comment_id']
     202    ) );
    203203
    204204    if ( !$comment_id ) {
     
    207207    }
    208208
    209     if ( bp_has_activities ( 'display_comments=stream&include=' . $comment_id ) ) : ?>
    210         <?php while ( bp_activities() ) : bp_the_activity(); ?>
    211             <li id="acomment-<?php bp_activity_id() ?>">
    212                 <div class="acomment-avatar">
    213                     <a href="<?php echo bp_core_get_userlink( bp_get_activity_user_id(), false, true ); ?>"><?php bp_activity_avatar( array( 'height' => 30, 'width' => 30 ) ); ?></a>
    214                 </div>
    215 
    216                 <div class="acomment-meta">
    217                     <?php
    218                     /* translators: 1: user profile link + username, 2: activity item permalink, 3: activity item timestamp */
    219                     printf( __( '%1$s replied <a href="%2$s">%3$s ago</a>', 'buddypress' ), bp_core_get_userlink( bp_get_activity_user_id() ), bp_get_activity_thread_permalink(), bp_core_time_since( bp_core_current_time() ) );
    220                     ?>
    221 
    222                     <a class="acomment-reply bp-primary-action" href="#acomment-<?php bp_activity_id() ?>" id="acomment-reply-<?php echo esc_attr( $_POST['form_id'] ) ?>"><?php _e( 'Reply', 'buddypress' ); ?></a>
    223 
    224                     <?php if ( bp_activity_user_can_delete() ) : ?>
    225                         <div class="acomment-options">
    226                             <a href="<?php echo wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/delete/' . bp_get_activity_id() . '?cid=' . $comment_id, 'bp_activity_delete_link' ) ?>" class="delete acomment-delete confirm bp-secondary-action" rel="nofollow"><?php _e( 'Delete', 'buddypress' ); ?></a>
    227                         </div>
    228                     <?php endif; ?>
    229                 </div>
    230 
    231                 <div class="acomment-content">
    232                     <?php bp_activity_content_body(); ?>
    233                 </div>
    234             </li>
    235         <?php endwhile; ?>
    236      <?php endif;
     209    global $activities_template;
     210
     211    // Load the nem activity item into the $activities_template global
     212    bp_has_activities( 'display_comments=stream&include=' . $comment_id );
     213
     214    // Swap the current comment with the activity item we just loaded
     215    $activities_template->activity->id              = $activities_template->activities[0]->item_id;
     216    $activities_template->activity->current_comment = $activities_template->activities[0];
     217
     218    $template = locate_template( 'activity/comment.php', false, false );
     219
     220    // Backward compatibility. In older versions of BP, the markup was
     221    // generated in the PHP instead of a template. This ensures that
     222    // older themes (which are not children of bp-default and won't
     223    // have the new template) will still work.
     224    if ( empty( $template ) )
     225        $template = BP_PLUGIN_DIR . '/bp-themes/bp-default/activity/comment.php';
     226
     227    load_template( $template, false );
     228
     229    unset( $activities_template );
    237230}
    238231add_action( 'wp_ajax_new_activity_comment', 'bp_dtheme_new_activity_comment' );
  • trunk/bp-themes/bp-default/_inc/css/default.css

    r4611 r4668  
    763763    font-style: normal;
    764764}
    765 a.bp-secondary-action:hover {
    766     background: #059AE7;
    767     border-color: #059AE7;
    768     color: #fff;
    769 }
    770765#reply-title {
    771766    margin-top: 0;
     
    104310386.1 - Activity
    10441039--------------------------------------------------------------*/
     1040#activity-stream {
     1041    margin-top: -5px;
     1042}
    10451043#item-body form#whats-new-form {
    10461044    border-bottom: 1px solid #ddd;
     
    11181116    position: relative;
    11191117}
    1120 .activity-list li.mini div.activity-meta {
    1121     margin: 0;
    1122 }
    1123 .activity-list li.mini div.activity-meta a {
    1124     padding: 3px 8px;
    1125 }
    11261118.activity-list li.mini .activity-avatar img.avatar,
    11271119.activity-list li.mini .activity-avatar img.FB_profile_pic {
    11281120    height: 20px;
    1129     margin-left: 76px;
     1121    margin-left: 30px;
    11301122    width: 20px;
    11311123}
     
    11491141}
    11501142.activity-list li.mini .activity-content p {
    1151     float: left;
    11521143    margin: 0;
    11531144}
    1154 .activity-list li .activity-meta {
    1155     position: absolute;
    1156     right: 0;
    1157     top: 0;
    1158 }
    1159 body.activity-permalink .activity-list .activity-meta {
    1160     right: 10px;
    1161     top: 18px;
    1162 }
    1163 body.activity-permalink .activity-list li.mini .activity-meta {
    1164     position: absolute;
    1165     right: 15px;
    1166 }
    11671145.activity-list li.mini .activity-comments {
    1168     clear: left;
     1146    clear: both;
    11691147    font-size: 12px;
    11701148    margin-top: 30px;
     
    11721150.activity-list li .activity-inreplyto {
    11731151    background: url( ../images/replyto_arrow.gif ) 7px 0 no-repeat;
    1174     color: #888;
    1175     font-size: 11px;
    1176     margin-left: 70px;
     1152    color: #bbb;
     1153    font-size: 11px;
     1154    margin-left: 0;
    11771155    margin-bottom: 15px;
    11781156    padding-left: 25px;
     
    12301208}
    12311209.activity-header {
    1232     margin-right: 130px;
     1210    margin-right: 20px;
    12331211}
    12341212.activity-header a,
     
    12431221a.bp-secondary-action,
    12441222span.highlight {
    1245     background: #ebf7ff;
    1246     border-bottom: 1px solid #a1dcfa;
    1247     border-right: 1px solid #a1dcfa;
    1248     -moz-border-radius: 4px;
    1249     -webkit-border-radius: 4px;
    1250     border-radius: 4px;
    1251     color: #059ae7;
    1252     font-size: 11px;
    1253     padding: 3px 8px;
     1223    font-size: 11px;
     1224    padding: 0;
     1225    margin-right: 10px;
    12541226    text-decoration: none;
    12551227}
    12561228.activity-list .activity-content .activity-inner,
    12571229.activity-list .activity-content blockquote {
    1258     margin: 15px 0;
     1230    margin: 10px 10px 5px 0;
    12591231    overflow: hidden;
    12601232}
     
    12771249.activity-read-more {
    12781250    margin-left: 1em;
     1251    white-space: nowrap;
    12791252}
    12801253.activity-list li.load-more {
     
    12991272--------------------------------------------------------------*/
    13001273div.activity-meta {
    1301     clear: left;
    1302     margin: 0 10px 20px 0;
     1274    float: left;
     1275    margin: 5px 0 10px 0;
     1276    clear: both;
     1277}
     1278div.activity-meta a {
     1279    color: #999;
     1280}
     1281div.activity-meta a:hover {
     1282    color: inherit;
    13031283}
    13041284a.bp-primary-action,
    13051285.comment-reply-link,
    13061286#reply-title small a {
    1307     background: #fff9db;
    1308     border-bottom: 1px solid #ffe8c4;
    1309     -moz-border-radius: 4px;
    1310     -webkit-border-radius: 4px;
    1311     border-radius: 4px;
    1312     border-right: 1px solid #ffe8c4;
    1313     color: #ffa200;
    1314     font-size: 11px;
    1315     padding: 3px 8px;
     1287    font-size: 11px;
     1288    margin-right: 10px;
    13161289    text-decoration: none;
    13171290}
     
    13191292.comment-reply-link:hover,
    13201293#reply-title small a:hover {
    1321     background: #f7740a;
    1322     border-color: #f7740a;
    1323     color: #fff;
    13241294}
    13251295div.activity-comments {
     
    13281298    position: relative;
    13291299    width: auto;
     1300    clear: both;
    13301301}
    13311302body.activity-permalink div.activity-comments {
     
    13471318}
    13481319div.activity-comments ul {
    1349     clear: left;
     1320    clear: both;
    13501321}
    13511322div.activity-comments ul li {
     
    13851356div.activity-comments div.acomment-content {
    13861357    font-size: 11px;
    1387     margin-left: 39px;
    1388     margin-top: 5px;
    1389     margin-bottom: 10px;
     1358    margin: 5px 20px 0 40px;
    13901359}
    13911360div.acomment-content .time-since,
     
    14131382div.activity-comments li form.ac-form {
    14141383    margin-right: 15px;
     1384    clear: both;
    14151385}
    14161386div.activity-comments form.root {
     
    14601430}
    14611431.acomment-options {
    1462     float: right;
    1463     margin-right: 10px;
     1432    float: left;
     1433    margin: 5px 0 5px 40px;
     1434}
     1435.acomment-options a {
     1436    color: #999;
     1437}
     1438.acomment-options a:hover {
     1439    color: inherit;
    14641440}
    14651441
  • trunk/bp-themes/bp-default/activity/comment.php

    r4611 r4668  
    2727        printf( __( '<a href="%1$s">%2$s</a> replied <a href="%3$s">%4$s</a>', 'buddypress' ), bp_get_activity_comment_user_link(), bp_get_activity_comment_name(), bp_get_activity_thread_permalink(), bp_get_activity_comment_date_recorded() );
    2828        ?>
     29    </div>
     30
     31    <div class="acomment-content"><?php bp_activity_comment_content(); ?></div>
     32
     33    <div class="acomment-options">
    2934
    3035        <?php if ( is_user_logged_in() && bp_activity_can_comment_reply( bp_activity_current_comment() ) ) : ?>
    31             <a href="#acomment-<?php bp_activity_comment_id(); ?>" class="acomment-reply bp-primary-action" id="acomment-reply-<?php bp_activity_id() ?>-from-<?php bp_activity_comment_id() ?>"><?php _e( 'Reply', 'buddypress' ); ?></a>
     36
     37            <a href="#acomment-<?php bp_activity_comment_id(); ?>" class="acomment-reply bp-primary-action" id="acomment-reply-<?php bp_activity_id() ?>-from-<?php bp_activity_comment_id() ?>"><?php _e( 'Comment', 'buddypress' ); ?></a>
     38
    3239        <?php endif; ?>
    3340
    3441        <?php if ( bp_activity_user_can_delete() ) : ?>
    35             <div class="acomment-options">
    36                 <a href="<?php bp_activity_comment_delete_link(); ?>" class="delete acomment-delete confirm bp-secondary-action" rel="nofollow"><?php _e( 'Delete', 'buddypress' ); ?></a>
    37             </div>
     42
     43            <a href="<?php bp_activity_comment_delete_link(); ?>" class="delete acomment-delete confirm bp-secondary-action" rel="nofollow"><?php _e( 'Delete', 'buddypress' ); ?></a>
     44
    3845        <?php endif; ?>
     46
    3947    </div>
    4048
    41     <div class="acomment-content">
    42         <?php bp_activity_comment_content(); ?>
    43     </div>
    44    
    4549    <?php bp_activity_recurse_comments( bp_activity_current_comment() ); ?>
    4650</li>
  • trunk/bp-themes/bp-default/activity/entry.php

    r4632 r4668  
    3232        </div>
    3333
     34        <?php if ( 'activity_comment' == bp_get_activity_type() ) : ?>
     35
     36            <div class="activity-inreplyto">
     37                <strong><?php _e( 'In reply to', 'buddypress' ); ?></strong> - <?php bp_activity_parent_content(); ?> &middot;
     38                <a href="<?php bp_activity_thread_permalink(); ?>" class="view" title="<?php _e( 'View Thread / Permalink', 'buddypress' ); ?>"><?php _e( 'View', 'buddypress' ); ?></a>
     39            </div>
     40
     41        <?php endif; ?>
     42
    3443        <?php if ( bp_activity_has_content() ) : ?>
    3544
     
    4453        <?php do_action( 'bp_activity_entry_content' ); ?>
    4554
    46         <div class="activity-meta">
    47             <?php
    48                 // Add the delete link if the user has permission on this item
    49                 if ( bp_activity_user_can_delete() )
    50                     bp_activity_delete_link();
    51             ?>
     55        <?php if ( is_user_logged_in() ) : ?>
    5256
    53             <?php if ( is_user_logged_in() && bp_activity_can_favorite() ) : ?>
    54                 <?php if ( !bp_get_activity_is_favorite() ) : ?>
    55                     <a href="<?php bp_activity_favorite_link(); ?>" class="fav bp-secondary-action" title="<?php esc_attr_e( 'Mark as Favorite', 'buddypress' ); ?>"><?php _e( 'Favorite', 'buddypress' ) ?></a>
    56                 <?php else : ?>
    57                     <a href="<?php bp_activity_unfavorite_link(); ?>" class="unfav bp-secondary-action" title="<?php esc_attr_e( 'Remove Favorite', 'buddypress' ); ?>"><?php _e( 'Remove Favorite', 'buddypress' ) ?></a>
     57            <div class="activity-meta">
     58
     59                <?php if ( bp_activity_can_comment() ) : ?>
     60
     61                    <a href="<?php bp_get_activity_comment_link(); ?>" class="acomment-reply bp-primary-action" id="acomment-comment-<?php bp_activity_id(); ?>"><?php printf( __( 'Comment (<span>%s</span>)', 'buddypress' ), bp_activity_get_comment_count() ); ?></a>
     62
    5863                <?php endif; ?>
    59             <?php endif; ?>
    6064
    61             <?php do_action( 'bp_activity_entry_meta' ); ?>
    62         </div>
     65                <?php if ( bp_activity_can_favorite() ) : ?>
     66
     67                    <?php if ( !bp_get_activity_is_favorite() ) : ?>
     68
     69                        <a href="<?php bp_activity_favorite_link(); ?>" class="fav bp-secondary-action" title="<?php esc_attr_e( 'Mark as Favorite', 'buddypress' ); ?>"><?php _e( 'Favorite', 'buddypress' ) ?></a>
     70
     71                    <?php else : ?>
     72
     73                        <a href="<?php bp_activity_unfavorite_link(); ?>" class="unfav bp-secondary-action" title="<?php esc_attr_e( 'Remove Favorite', 'buddypress' ); ?>"><?php _e( 'Remove Favorite', 'buddypress' ) ?></a>
     74
     75                    <?php endif; ?>
     76
     77                <?php endif; ?>
     78
     79                <?php if ( bp_activity_user_can_delete() ) bp_activity_delete_link(); ?>
     80
     81                <?php do_action( 'bp_activity_entry_meta' ); ?>
     82
     83            </div>
     84
     85        <?php endif; ?>
     86
    6387    </div>
    64 
    65     <?php if ( 'activity_comment' == bp_get_activity_type() ) : ?>
    66 
    67         <div class="activity-inreplyto">
    68             <strong><?php _e( 'In reply to', 'buddypress' ); ?></strong> - <?php bp_activity_parent_content(); ?> &middot;
    69             <a href="<?php bp_activity_thread_permalink(); ?>" class="view" title="<?php _e( 'View Thread / Permalink', 'buddypress' ); ?>"><?php _e( 'View', 'buddypress' ); ?></a>
    70         </div>
    71 
    72     <?php endif; ?>
    7388
    7489    <?php do_action( 'bp_before_activity_entry_comments' ); ?>
    7590
    7691    <?php if ( bp_activity_can_comment() ) : ?>
     92
    7793        <div class="activity-comments">
    7894           
     
    8197            <?php if ( is_user_logged_in() ) : ?>
    8298
    83             <form action="<?php bp_activity_comment_form_action(); ?>" method="post" id="ac-form-<?php bp_activity_id(); ?>" class="ac-form"<?php bp_activity_comment_form_nojs_display(); ?>>
    84                 <div class="ac-reply-avatar"><?php bp_loggedin_user_avatar( 'width=' . bp_core_avatar_thumb_width() . '&height=' . bp_core_avatar_thumb_height() ); ?></div>
    85                 <div class="ac-reply-content">
    86                     <div class="ac-textarea">
    87                         <textarea id="ac-input-<?php bp_activity_id(); ?>" class="ac-input" name="ac_input_<?php bp_activity_id(); ?>"></textarea>
     99                <form action="<?php bp_activity_comment_form_action(); ?>" method="post" id="ac-form-<?php bp_activity_id(); ?>" class="ac-form"<?php bp_activity_comment_form_nojs_display(); ?>>
     100                    <div class="ac-reply-avatar"><?php bp_loggedin_user_avatar( 'width=' . BP_AVATAR_THUMB_WIDTH . '&height=' . BP_AVATAR_THUMB_HEIGHT ); ?></div>
     101                    <div class="ac-reply-content">
     102                        <div class="ac-textarea">
     103                            <textarea id="ac-input-<?php bp_activity_id(); ?>" class="ac-input" name="ac_input_<?php bp_activity_id(); ?>"></textarea>
     104                        </div>
     105                        <input type="submit" name="ac_form_submit" value="<?php _e( 'Post', 'buddypress' ); ?> &rarr;" /> &nbsp; <?php _e( 'or press esc to cancel.', 'buddypress' ); ?>
     106                        <input type="hidden" name="comment_form_id" value="<?php bp_activity_id(); ?>" />
    88107                    </div>
    89                     <input type="submit" name="ac_form_submit" value="<?php _e( 'Post', 'buddypress' ); ?> &rarr;" /> &nbsp; <?php _e( 'or press esc to cancel.', 'buddypress' ); ?>
    90                     <input type="hidden" name="comment_form_id" value="<?php bp_activity_id(); ?>" />
    91                 </div>
    92108
    93                 <?php do_action( 'bp_activity_entry_comments' ); ?>
    94                 <?php wp_nonce_field( 'new_activity_comment', '_wpnonce_new_activity_comment' ); ?>
     109                    <?php do_action( 'bp_activity_entry_comments' ); ?>
    95110
    96             </form>
     111                    <?php wp_nonce_field( 'new_activity_comment', '_wpnonce_new_activity_comment' ); ?>
     112
     113                </form>
    97114
    98115            <?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.