Skip to:
Content

BuddyPress.org

Changeset 13259


Ignore:
Timestamp:
03/15/2022 09:48:27 PM (3 years ago)
Author:
imath
Message:

BP Nouveau: highlight the Messages UI compose nav when clicked

This nav was only set as current when the compose URL was loaded. As soon as the screen display was managed using JavaScript, it wasn't highlighted/set as current when clicked. This commit makes sure it's now the case.

Props devanshijoshi

See #8648 (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/js/buddypress-messages.js

    r13196 r13259  
    22/* jshint devel: true */
    33/* @since 3.0.0 */
    4 /* @version 8.0.0 */
     4/* @version 10.2.0 */
    55window.wp = window.wp || {};
    66window.bp = window.bp || {};
     
    9898        },
    9999
     100        updateNav: function( view ) {
     101            var currentView = this.box;
     102
     103            if ( view ) {
     104                currentView = view;
     105            }
     106
     107            // Activate the appropriate nav.
     108            $( '#subnav ul li' ).each( function( l, li ) {
     109                $( li ).removeClass( 'current selected' );
     110            } );
     111
     112            $( '#subnav a#' + currentView ).closest( 'li' ).addClass( 'current selected' );
     113        },
     114
    100115        removeTinyMCE: function() {
    101116            if ( typeof tinymce !== 'undefined' ) {
     
    170185            // Remove all existing views.
    171186            this.clearViews();
     187            this.updateNav( 'compose' );
    172188
    173189            // Create the loop view.
     
    182198
    183199        threadsView: function() {
    184             // Activate the appropriate nav.
    185             $( '#subnav ul li' ).each( function( l, li ) {
    186                 $( li ).removeClass( 'current selected' );
    187             } );
    188             $( '#subnav a#' + this.box ).closest( 'li' ).addClass( 'current selected' );
     200            this.updateNav();
    189201
    190202            // Create the loop view.
Note: See TracChangeset for help on using the changeset viewer.