Ticket #6569: 6569.03.patch
File 6569.03.patch, 13.5 KB (added by , 9 years ago) |
---|
-
src/bp-activity/bp-activity-template.php
diff --git src/bp-activity/bp-activity-template.php src/bp-activity/bp-activity-template.php index 8fc2f6b..c1961e8 100644
function bp_activity_per_page() { 993 993 } 994 994 995 995 /** 996 * Output the activity post form textarea placeholder. 997 * 998 * @since 2.4.0 999 * 1000 * @uses bp_get_activity_whats_new_placeholder() 1001 */ 1002 function bp_activity_whats_new_placeholder() { 1003 echo bp_get_activity_whats_new_placeholder(); 1004 } 1005 1006 /** 1007 * Return the activity post form textarea placeholder. 1008 * 1009 * @since 2.4.0 1010 * 1011 * @uses apply_filters() To call the 'bp_get_activity_per_page' hook. 1012 * 1013 * @return string The activity post form textarea placeholder. 1014 */ 1015 function bp_get_activity_whats_new_placeholder() { 1016 $placeholder = sprintf( __( "What's new, %s?", 'buddypress' ), bp_get_user_firstname( bp_get_loggedin_user_fullname() ) ); 1017 1018 if ( bp_is_group() ) { 1019 $placeholder = sprintf( __( "What's new in %s, %s?", 'buddypress' ), bp_get_group_name(), bp_get_user_firstname( bp_get_loggedin_user_fullname() ) ); 1020 } 1021 1022 /** 1023 * Filters the activity post form textarea placeholder. 1024 * 1025 * @since 2.4.0 1026 * 1027 * @param string $placeholder the activity post form textarea placeholder. 1028 */ 1029 return apply_filters( 'bp_get_activity_whats_new_placeholder', $placeholder ); 1030 } 1031 1032 /** 996 1033 * Output the activities title. 997 1034 * 998 1035 * @since 1.0.0 -
src/bp-templates/bp-legacy/buddypress/activity/post-form.php
diff --git src/bp-templates/bp-legacy/buddypress/activity/post-form.php src/bp-templates/bp-legacy/buddypress/activity/post-form.php index 12023a8..c8d4054 100644
26 26 </a> 27 27 </div> 28 28 29 <p class="activity-greeting"><?php if ( bp_is_group() )30 printf( __( "What's new in %s, %s?", 'buddypress' ), bp_get_group_name(), bp_get_user_firstname( bp_get_loggedin_user_fullname() ) );31 else32 printf( __( "What's new, %s?", 'buddypress' ), bp_get_user_firstname( bp_get_loggedin_user_fullname() ) );33 ?></p>34 35 29 <div id="whats-new-content"> 30 36 31 <div id="whats-new-textarea"> 37 <textarea class="bp-suggestions" name="whats-new" id="whats-new" cols="50" rows="1 0"32 <textarea class="bp-suggestions" name="whats-new" id="whats-new" cols="50" rows="1" 38 33 <?php if ( bp_is_group() ) : ?>data-suggestions-group-id="<?php echo esc_attr( (int) bp_get_current_group_id() ); ?>" <?php endif; ?> 39 ><?php if ( isset( $_GET['r'] ) ) : ?>@<?php echo esc_textarea( $_GET['r'] ); ?> <?php endif; ?></textarea>34 placeholder="<?php echo esc_attr( bp_get_activity_whats_new_placeholder() ) ;?>"><?php if ( isset( $_GET['r'] ) ) : ?>@<?php echo esc_textarea( $_GET['r'] ); ?> <?php endif; ?></textarea> 40 35 </div> 41 36 42 <div id="whats-new-options"> 43 <div id="whats-new-submit"> 44 <input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="<?php esc_attr_e( 'Post Update', 'buddypress' ); ?>" /> 45 </div> 37 <div id="whats-new-actions"> 38 <?php 39 /** 40 * Fires before the activity post form options. 41 * 42 * @since BuddyPress (2.4.0) 43 */ 44 do_action( 'bp_activity_post_form_before_options' ); ?> 46 45 47 < ?php if ( bp_is_active( 'groups' ) && !bp_is_my_profile() && !bp_is_group() ) : ?>46 <div id="whats-new-options"> 48 47 49 < div id="whats-new-post-in-box">48 <?php if ( bp_is_active( 'groups' ) && !bp_is_my_profile() && !bp_is_group() ) : ?> 50 49 51 < ?php _e( 'Post in', 'buddypress' ); ?>:50 <div id="whats-new-post-in-box"> 52 51 53 <select id="whats-new-post-in" name="whats-new-post-in"> 54 <option selected="selected" value="0"><?php _e( 'My Profile', 'buddypress' ); ?></option> 52 <?php _e( 'Post in', 'buddypress' ); ?>: 55 53 56 < ?php if ( bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100&populate_extras=0&update_meta_cache=0' ) ) :57 while ( bp_groups() ) : bp_the_group(); ?>54 <select id="whats-new-post-in" name="whats-new-post-in"> 55 <option selected="selected" value="0"><?php _e( 'My Profile', 'buddypress' ); ?></option> 58 56 59 <option value="<?php bp_group_id(); ?>"><?php bp_group_name(); ?></option> 57 <?php if ( bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100&populate_extras=0&update_meta_cache=0' ) ) : 58 while ( bp_groups() ) : bp_the_group(); ?> 60 59 61 <?php endwhile; 62 endif; ?> 60 <option value="<?php bp_group_id(); ?>"><?php bp_group_name(); ?></option> 63 61 64 </select> 65 </div> 66 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 62 <?php endwhile; 63 endif; ?> 67 64 68 <?php elseif ( bp_is_group_home() ) : ?> 65 </select> 66 </div> 67 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 69 68 70 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 71 <input type="hidden" id="whats-new-post-in" name="whats-new-post-in" value="<?php bp_group_id(); ?>" /> 69 <?php elseif ( bp_is_group_home() ) : ?> 72 70 73 <?php endif; ?> 71 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 72 <input type="hidden" id="whats-new-post-in" name="whats-new-post-in" value="<?php bp_group_id(); ?>" /> 74 73 75 <?php74 <?php endif; ?> 76 75 76 <?php 77 78 /** 79 * Fires at the end of the activity post form options. 80 * 81 * @since BuddyPress (1.2.0) 82 */ 83 do_action( 'bp_activity_post_form_options' ); ?> 84 85 </div><!-- #whats-new-options --> 86 87 <?php 77 88 /** 78 * Fires at the end of the activity post form markup.89 * Fires before the activity post form submit. 79 90 * 80 * @since BuddyPress ( 1.2.0)91 * @since BuddyPress (2.4.0) 81 92 */ 82 do_action( 'bp_activity_post_form_options' ); ?> 93 do_action( 'bp_activity_post_form_before_submit' ); ?> 94 95 <div id="whats-new-submit"> 96 97 <input type="reset" name="aw-whats-new-reset" id="aw-whats-new-reset" value="<?php esc_attr_e( 'Cancel', 'buddypress' ); ?>" /> 98 <input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="<?php esc_attr_e( 'Post Update', 'buddypress' ); ?>" /> 83 99 84 </div><!-- #whats-new-options --> 100 <?php 101 /** 102 * Fires at the end of the activity post form submit. 103 * 104 * @since BuddyPress (2.4.0) 105 */ 106 do_action( 'bp_activity_post_form_submit' ); ?> 107 </div><!-- #whats-new-submit --> 108 </div><!-- #whats-new-actions --> 85 109 </div><!-- #whats-new-content --> 86 110 87 111 <?php wp_nonce_field( 'post_update', '_wpnonce_post_update' ); ?> -
src/bp-templates/bp-legacy/css/buddypress.css
diff --git src/bp-templates/bp-legacy/css/buddypress.css src/bp-templates/bp-legacy/css/buddypress.css index aca34c6..0bf0d9e 100644
Hello, this is the BuddyPress Legacy stylesheet. 127 127 color: #555; 128 128 font-family: inherit; 129 129 font-size: medium; 130 height: 20px;131 130 padding: 6px; 132 width: 98%; 131 width: 97.5%; 132 height: auto; 133 resize: none; 134 overflow: hidden; 133 135 } 134 136 body.no-js #buddypress form#whats-new-form textarea { 135 137 height: 50px; 138 resize: vertical; 139 overflow: auto; 136 140 } 137 141 #buddypress form#whats-new-form #whats-new-options select { 138 142 max-width: 200px; … … body.no-js #buddypress form#whats-new-form textarea { 142 146 float: right; 143 147 margin-top: 12px; 144 148 } 149 145 150 #buddypress #whats-new-options { 146 151 overflow: auto; 152 height: auto; 153 float:left; 154 } 155 156 #buddypress #whats-new-content #whats-new-actions { 147 157 height: 0; 148 158 } 159 160 #buddypress #whats-new-content.active #whats-new-actions { 161 width: auto; 162 } 163 149 164 body.no-js #buddypress #whats-new-options { 150 165 height: auto; 151 166 } … … body.no-js #buddypress #whats-new-options { 154 169 outline-color: rgba(31, 179, 221, 0.9); 155 170 } 156 171 172 #buddypress #whats-new-content, #buddypress #whats-new-actions { 173 overflow: hidden; 174 } 175 157 176 /*-------------------------------------------------------------- 158 177 3.1.1 - Activity Listing 159 178 --------------------------------------------------------------*/ -
src/bp-templates/bp-legacy/js/buddypress.js
diff --git src/bp-templates/bp-legacy/js/buddypress.js src/bp-templates/bp-legacy/js/buddypress.js index 4c5e139..255b8a3 100644
jq(document).ready( function() { 32 32 if ( $whats_new.length && bp_get_querystring('r') ) { 33 33 var $member_nicename = $whats_new.val(); 34 34 35 jq('#whats-new-options').animate({ 36 height:'50px' 37 }); 38 39 $whats_new.animate({ 40 height:'50px' 35 jq('#whats-new-actions').animate({ 36 height:'100%' 41 37 }); 42 38 43 39 jq.scrollTo( $whats_new, 500, { … … jq(document).ready( function() { 52 48 53 49 /* Textarea focus */ 54 50 $whats_new.focus( function(){ 55 jq('#whats-new-options').animate({ 56 height:'50px' 57 }); 58 jq('#whats-new-form textarea').animate({ 59 height:'50px' 51 jq('#whats-new-actions').animate({ 52 height:'100%' 60 53 }); 54 61 55 jq('#aw-whats-new-submit').prop('disabled', false); 62 56 63 57 jq( '#whats-new-content' ).addClass( 'active' ); … … jq(document).ready( function() { 83 77 } 84 78 }); 85 79 86 /* On blur, shrink if it's empty */ 87 $whats_new.blur( function(){ 88 if ( document.activeElement !== this ) { 89 if (!this.value.match(/\S+/)) { 90 this.value = ''; 91 jq('#whats-new-options').animate({ 92 height:'0' 93 }); 94 jq('form#whats-new-form textarea').animate({ 95 height:'20px' 96 }); 97 jq('#aw-whats-new-submit').prop('disabled', true); 98 jq( '#whats-new-content' ).removeClass( 'active' ); 99 } 80 /* On reset button click, reset the form and shrink if */ 81 jq( '#whats-new-form' ).on( 'reset', function() { 82 // Make sure the textarea has been emptied 83 // When ?r=@username it's not the case 84 jq( '#whats-new-form textarea').text( '' ); 85 86 jq( '#whats-new-actions' ).animate( { 87 height:'0' 88 } ); 89 90 jq( '#whats-new-form textarea').css( { 91 height:'auto' 92 } ); 93 94 jq( '#aw-whats-new-submit').prop( 'disabled', true ); 95 jq( '#whats-new-content' ).removeClass( 'active' ); 96 } ); 97 98 /* Texarea auto-resize */ 99 $whats_new.on( 'keyup', function( event ) { 100 var self = jq( this ); 101 102 if ( this.scrollHeight <= self.innerHeight() ) { 103 return; 100 104 } 101 }); 105 106 self.css( { 107 height: this.scrollHeight + 'px' 108 } ); 109 } ); 102 110 103 111 /* New posts */ 104 112 jq('#aw-whats-new-submit').on( 'click', function() { 105 113 var last_date_recorded = 0, 106 114 button = jq(this), 107 form = button.closest('form#whats-new-form'); 115 form = button.closest('form#whats-new-form'), 116 inputs = {}, post_data; 117 118 // Get all inputs and organize them into an object {name: value} 119 jq.each( form.serializeArray(), function( key, input ) { 120 // Only include public extra data 121 if ( '_' !== input.name.substr( 0, 1 ) && 'whats-new' !== input.name.substr( 0, 9 ) ) { 122 if ( ! inputs[ input.name ] ) { 123 inputs[ input.name ] = input.value; 124 } else { 125 // Checkboxes/dropdown list can have multiple selected value 126 if ( ! jq.isArray( inputs[ input.name ] ) ) { 127 inputs[ input.name ] = new Array( inputs[ input.name ], input.value ); 128 } else { 129 inputs[ input.name ].push( input.value ); 130 } 131 } 132 } 133 } ); 108 134 109 form. children().each( function() {110 if ( jq.nodeName( this, 'textarea') || jq.nodeName(this, 'input') ) {135 form.find( '*' ).each( function() { 136 if ( jq.nodeName( this, 'textarea') || jq.nodeName( this, 'input' ) ) { 111 137 jq(this).prop( 'disabled', true ); 112 138 } 113 } );139 } ); 114 140 115 141 /* Remove any errors */ 116 142 jq('div.error').remove(); … … jq(document).ready( function() { 145 171 object = jq('#whats-new-post-object').val(); 146 172 } 147 173 148 jq.post( ajaxurl, { 149 action: 'post_update', 150 'cookie': bp_get_cookies(), 151 '_wpnonce_post_update': jq('#_wpnonce_post_update').val(), 152 'content': content, 153 'object': object, 154 'item_id': item_id, 155 'since': last_date_recorded, 156 '_bp_as_nonce': jq('#_bp_as_nonce').val() || '' 157 }, 158 function(response) { 174 // Include the public data to the post data 175 post_data = jq.extend( { 176 action : 'post_update', 177 'cookie' : bp_get_cookies(), 178 '_wpnonce_post_update' : jq('#_wpnonce_post_update').val(), 179 'content' : content, 180 'object' : object, 181 'item_id' : item_id, 182 'since' : last_date_recorded, 183 '_bp_as_nonce' : jq('#_bp_as_nonce').val() || '', 184 }, inputs ); 185 186 jq.post( ajaxurl, post_data, function( response ) { 159 187 160 form. children().each( function() {161 if ( jq.nodeName( this, 'textarea') || jq.nodeName(this, 'input') ) {162 jq( this).prop( 'disabled', false );188 form.find( '*' ).each( function() { 189 if ( jq.nodeName( this, 'textarea') || jq.nodeName( this, 'input' ) ) { 190 jq( this ).prop( 'disabled', false ); 163 191 } 164 } );192 } ); 165 193 166 194 /* Check for errors and append if found. */ 167 195 if ( response[0] + response[1] === '-1' ) { … … jq(document).ready( function() { 204 232 205 233 jq('li.new-update').hide().slideDown( 300 ); 206 234 jq('li.new-update').removeClass( 'new-update' ); 207 jq('#whats-new').val(''); 235 236 // Reset the form 237 form.get(0).reset(); 208 238 209 239 // reset vars to get newest activities 210 240 newest_activities = ''; 211 241 activity_last_recorded = 0; 212 242 } 213 243 214 jq('#whats-new- options').animate({244 jq('#whats-new-actions').animate({ 215 245 height:'0px' 216 246 }); 217 jq('#whats-new-form textarea').animate({ 218 height:'20px' 219 }); 247 220 248 jq('#aw-whats-new-submit').prop('disabled', true).removeClass('loading'); 221 249 jq( '#whats-new-content' ).removeClass( 'active' ); 222 } );250 } ); 223 251 224 252 return false; 225 253 });