[buddypress-trac] [BuddyPress Trac] #7315: Autocomplete in messages produces bad html

buddypress-trac noreply at wordpress.org
Wed Nov 2 16:07:53 UTC 2016


#7315: Autocomplete in messages produces bad html
--------------------------+-----------------------------
 Reporter:  N.Hans.er     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Messages      |    Version:  2.7
 Severity:  minor         |   Keywords:  needs-patch
--------------------------+-----------------------------
 First, it is my first ticket here.
 I use the last version (2.7).

 In compose.php file (members/single/messages), you have :

 {{{
         <ul class="first acfb-holder">
 <li>
                 <?php bp_message_get_recipient_tabs(); ?>
                         <input type="text" name="send-to-input" class
 ="send-to-input" id="send-to-input" />
 </li>
         </ul>
 }}}

 where bp_message_get_recipient_tabs() produces nested <li></li> elements
 inside 'li' tag

 Proposed changes :

 {{{
         <ul class="first acfb-holder">
                 <?php bp_message_get_recipient_tabs(); ?>
 <li>

                         <input type="text" name="send-to-input" class
 ="send-to-input" id="send-to-input" />
 </li>
         </ul>
 }}}

 It is needed to change file 'bp-
 messages/js/autocomplete/jquery.autocompletefb.js' as :

 {{{
 /* Don't add the same user multiple times */
                 if( 0 ===
 jQuery(settings.inputClass).closest('li').siblings('#un-' + un).length ) {
                         var ln = '#link-' + un;
                         var l = jQuery(ln).attr('href');
                         var v = '<li class="'+f+'" id="un-'+un+'"><span><a
 href="'+l+'">'+d[0]+'</a></span> <span class="p">X</span></li>';

                         var x =
 jQuery(settings.inputClass,tmp).closest('li').before(v);
                         jQuery('#send-to-usernames').addClass(un);

 jQuery('.p',x[0].previousSibling).click(function(){
                                 acfb.removeFind(this);
                         });
                 }

 }}}

 It includes two modifications :
 * first in the test to not have twice the same element
 * add of 'li' element using "closest('li')"

 By the way, I think the input should not be in the 'ul' to stay in place
 and not moving after 'li' of recipients

 Note 1 : the "closest('li')" thing was fixed (I saw tickets) in a previous
 version and was lost somewhere...
 Note 2 : I read somewhere that this autocomplete thing will be replace by
 "BP_Suggestion". I'm not familiar with it, but the change may be useless
 then.

 Regards

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7315>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list