Changeset 8063
- Timestamp:
- 03/06/2014 02:50:45 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-template.php
r8062 r8063 3319 3319 } 3320 3320 3321 /** 3322 * Output pagination links for group invitations. 3323 * 3324 * @since BuddyPress (2.0.0) 3325 */ 3326 function bp_group_invite_pagination_links() { 3327 echo bp_get_group_invite_pagination_links(); 3328 } 3329 /** 3330 * Get pagination links for group invitations. 3331 * 3332 * @since BuddyPress (2.0.0) 3333 * 3334 * @return string 3335 */ 3336 function bp_get_group_invite_pagination_links() { 3337 global $invites_template; 3338 return apply_filters( 'bp_get_group_invite_pagination_links', $invites_template->pag_links ); 3339 } 3340 3341 /** 3342 * Output pagination count text for group invitations. 3343 * 3344 * @since BuddyPress (2.0.0) 3345 */ 3346 function bp_group_invite_pagination_count() { 3347 echo bp_get_group_invite_pagination_count(); 3348 } 3349 /** 3350 * Get pagination count text for group invitations. 3351 * 3352 * @since BuddyPress (2.0.0) 3353 * 3354 * @return string 3355 */ 3356 function bp_get_group_invite_pagination_count() { 3357 global $invites_template; 3358 3359 $start_num = intval( ( $invites_template->pag_page - 1 ) * $invites_template->pag_num ) + 1; 3360 $from_num = bp_core_number_format( $start_num ); 3361 $to_num = bp_core_number_format( ( $start_num + ( $invites_template->pag_num - 1 ) > $invites_template->total_invite_count ) ? $invites_template->total_invite_count : $start_num + ( $invites_template->pag_num - 1 ) ); 3362 $total = bp_core_number_format( $invites_template->total_invite_count ); 3363 3364 return apply_filters( 'bp_get_groups_pagination_count', sprintf( _n( 'Viewing invitation %1$s to %2$s (of %3$s invitation)', 'Viewing invitation %1$s to %2$s (of %3$s invitations)', $total, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total ); 3365 } 3366 3321 3367 /*** 3322 3368 * Groups RSS Feed Template Tags -
trunk/bp-templates/bp-legacy/buddypress-functions.php
r8052 r8063 140 140 'members_filter' => 'bp_legacy_theme_object_template_loader', 141 141 'messages_filter' => 'bp_legacy_theme_messages_template_loader', 142 'invite_filter' => 'bp_legacy_theme_invite_template_loader', 142 143 143 144 // Friends … … 602 603 603 604 /** 605 * Load group invitations loop to handle pagination requests sent via AJAX. 606 * 607 * @since BuddyPress (2.0.0) 608 */ 609 function bp_legacy_theme_invite_template_loader() { 610 bp_get_template_part( 'groups/single/invites-loop' ); 611 exit(); 612 } 613 614 /** 604 615 * Load the activity loop template when activity is requested via AJAX, 605 616 * -
trunk/bp-templates/bp-legacy/buddypress/groups/single/send-invites.php
r7965 r8063 3 3 <?php if ( bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?> 4 4 5 <?php /* 'send-invite-form' is important for AJAX support */ ?> 5 6 <form action="<?php bp_group_send_invite_form_action(); ?>" method="post" id="send-invite-form" class="standard-form" role="main"> 6 7 7 <div class=" left-menu">8 <div class="invite"> 8 9 9 <div id="invite-list"> 10 <ul> 11 <?php bp_new_group_invite_friend_list(); ?> 12 </ul> 10 <?php bp_get_template_part( 'groups/single/invites-loop' ); ?> 13 11 14 <?php wp_nonce_field( 'groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user' ); ?>15 </div>16 17 </div><!-- .left-menu -->18 19 <div class="main-column">20 21 <div id="message" class="info">22 <p><?php _e('Select people to invite from your friends list.', 'buddypress' ); ?></p>23 </div>24 25 <?php do_action( 'bp_before_group_send_invites_list' ); ?>26 27 <?php /* The ID 'friend-list' is important for AJAX support. */ ?>28 <ul id="friend-list" class="item-list">29 <?php if ( bp_group_has_invites() ) : ?>30 31 <?php while ( bp_group_invites() ) : bp_group_the_invite(); ?>32 33 <li id="<?php bp_group_invite_item_id(); ?>">34 <?php bp_group_invite_user_avatar(); ?>35 36 <h4><?php bp_group_invite_user_link(); ?></h4>37 <span class="activity"><?php bp_group_invite_user_last_active(); ?></span>38 39 <?php do_action( 'bp_group_send_invites_item' ); ?>40 41 <div class="action">42 <a class="button remove" href="<?php bp_group_invite_user_remove_invite_url(); ?>" id="<?php bp_group_invite_item_id(); ?>"><?php _e( 'Remove Invite', 'buddypress' ); ?></a>43 44 <?php do_action( 'bp_group_send_invites_item_action' ); ?>45 </div>46 </li>47 48 <?php endwhile; ?>49 50 <?php endif; ?>51 </ul><!-- #friend-list -->52 53 <?php do_action( 'bp_after_group_send_invites_list' ); ?>54 55 </div><!-- .main-column -->56 57 <div class="clear"></div>58 59 <div class="submit">60 <input type="submit" name="submit" id="submit" value="<?php esc_attr_e( 'Send Invites', 'buddypress' ); ?>" />61 12 </div> 62 63 <?php wp_nonce_field( 'groups_send_invites', '_wpnonce_send_invites' ); ?>64 13 65 14 <?php /* This is important, don't forget it */ ?> … … 68 17 </form><!-- #send-invite-form --> 69 18 70 <?php else : ?>71 72 <div id="message" class="info" role="main">73 <p><?php _e( 'Once you have built up friend connections you will be able to invite others to your group.', 'buddypress' ); ?></p>74 </div>75 76 19 <?php endif; ?> 77 20 -
trunk/bp-templates/bp-legacy/css/buddypress.css
r7960 r8063 765 765 #buddypress form.standard-form .main-column ul#friend-list { 766 766 clear:none; 767 float: left; 767 768 } 768 769 -
trunk/bp-templates/bp-legacy/js/buddypress.js
r8021 r8063 902 902 903 903 /* Select a user from the list of friends and add them to the invite list */ 904 jq("#invite-list input").on( 'click', function() { 904 jq("#send-invite-form").on( 'click', '#invite-list input', function() { 905 // invites-loop template contains a div with the .invite class 906 // We use the existence of this div to check for old- vs new- 907 // style templates. 908 var invites_new_template = jq( "#send-invite-form > .invite" ).length; 909 905 910 jq('.ajax-loader').toggle(); 906 911 912 // Dim the form until the response arrives 913 if ( invites_new_template ) { 914 jq( this ).parents( 'ul' ).find( 'input' ).prop( 'disabled', true ); 915 } 916 907 917 var friend_id = jq(this).val(); 908 918 909 if ( jq(this).prop('checked') == true ) 919 if ( jq(this).prop('checked') == true ) { 910 920 var friend_action = 'invite'; 911 else921 } else { 912 922 var friend_action = 'uninvite'; 913 914 jq('.item-list-tabs li.selected').addClass('loading'); 923 } 924 925 if ( ! invites_new_template ) { 926 jq( '.item-list-tabs li.selected' ).addClass( 'loading' ); 927 } 915 928 916 929 jq.post( ajaxurl, { … … 924 937 function(response) 925 938 { 926 if ( jq("#message") ) 939 if ( jq("#message") ) { 927 940 jq("#message").hide(); 928 929 jq('.ajax-loader').toggle(); 930 931 if ( friend_action == 'invite' ) { 932 jq('#friend-list').append(response); 933 } else if ( friend_action == 'uninvite' ) { 934 jq('#friend-list li#uid-' + friend_id).remove(); 935 } 936 937 jq('.item-list-tabs li.selected').removeClass('loading'); 941 } 942 943 if ( invites_new_template ) { 944 // With new-style templates, we refresh the 945 // entire list 946 bp_filter_request( 'invite', 'bp-invite-filter', 'bp-invite-scope', 'div.invite', false, 1, '', '', '' ); 947 } else { 948 // Old-style templates manipulate only the 949 // single invitation element 950 jq('.ajax-loader').toggle(); 951 952 if ( friend_action == 'invite' ) { 953 jq('#friend-list').append(response); 954 } else if ( friend_action == 'uninvite' ) { 955 jq('#friend-list li#uid-' + friend_id).remove(); 956 } 957 958 jq('.item-list-tabs li.selected').removeClass('loading'); 959 } 938 960 }); 939 961 }); 940 962 941 963 /* Remove a user from the list of users to invite to a group */ 942 jq("#friend-list").on('click', 'li a.remove', function() { 964 jq("#send-invite-form").on('click', 'a.remove', function() { 965 // invites-loop template contains a div with the .invite class 966 // We use the existence of this div to check for old- vs new- 967 // style templates. 968 var invites_new_template = jq("#send-invite-form > .invite").length; 969 943 970 jq('.ajax-loader').toggle(); 944 971 … … 957 984 function(response) 958 985 { 959 jq('.ajax-loader').toggle(); 960 jq('#friend-list #uid-' + friend_id).remove(); 961 jq('#invite-list #f-' + friend_id).prop('checked', false); 986 if ( invites_new_template ) { 987 // With new-style templates, we refresh the 988 // entire list 989 bp_filter_request( 'invite', 'bp-invite-filter', 'bp-invite-scope', 'div.invite', false, 1, '', '', '' ); 990 } else { 991 // Old-style templates manipulate only the 992 // single invitation element 993 jq('.ajax-loader').toggle(); 994 jq('#friend-list #uid-' + friend_id).remove(); 995 jq('#invite-list #f-' + friend_id).prop('checked', false); 996 } 962 997 }); 963 998
Note: See TracChangeset
for help on using the changeset viewer.