Skip to:
Content

BuddyPress.org

Ticket #7731: 7731.2.patch

File 7731.2.patch, 7.3 KB (added by imath, 7 years ago)
  • src/bp-templates/bp-nouveau/css/buddypress-rtl.css

    diff --git src/bp-templates/bp-nouveau/css/buddypress-rtl.css src/bp-templates/bp-nouveau/css/buddypress-rtl.css
    index 8ca16031f..9dbfd6c1f 100644
    body.register .buddypress-wrap .page ul { 
    30043004        background-color: #fafafa;
    30053005}
    30063006
     3007#message-threads li.unread {
     3008        font-weight: bold;
     3009}
     3010
    30073011#message-threads li.selected .thread-subject .subject {
    30083012        color: #5087e5;
    30093013}
  • src/bp-templates/bp-nouveau/css/buddypress.css

    diff --git src/bp-templates/bp-nouveau/css/buddypress.css src/bp-templates/bp-nouveau/css/buddypress.css
    index 937c37a67..5c8c814bc 100644
    body.register .buddypress-wrap .page ul { 
    30043004        background-color: #fafafa;
    30053005}
    30063006
     3007#message-threads li.unread {
     3008        font-weight: bold;
     3009}
     3010
    30073011#message-threads li.selected .thread-subject .subject {
    30083012        color: #5087e5;
    30093013}
  • src/bp-templates/bp-nouveau/includes/messages/functions.php

    diff --git src/bp-templates/bp-nouveau/includes/messages/functions.php src/bp-templates/bp-nouveau/includes/messages/functions.php
    index 693e5e51e..2f22ec7b4 100644
    function bp_nouveau_messages_localize_scripts( $params = array() ) { 
    9999                        'send' => wp_create_nonce( 'messages_send_message' ),
    100100                ),
    101101                'loading' => '<div class="bp-feedback info"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'Loading messages. Please wait.', 'buddypress' ) . '</p></div>',
     102                'howto' => '<div class="bp-feedback info"><span class="bp-icon" aria-hidden="true"></span><p>' .
     103                        __( 'Click on the message title to preview it in the Active conversation box. Double click on the message title to open the full conversation.', 'buddypress' ) . ' ' .
     104                        __( 'Alternatively you can navigate through the conversations list using the <code>tab</code> key of your keyboard and press the <code>enter</code> or <code>space</code> key to open the full active conversation.', 'buddypress' ) .
     105                        '</p></div>',
     106                        'howtoBulk' => '<div class="bp-feedback info"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'Use the select box to define your bulk action and click on the &#10003; button to apply.', 'buddypress' ) . '</p></div>',
    102107                'bulk_actions' => bp_nouveau_messages_get_bulk_actions(),
    103108        );
    104109
  • src/bp-templates/bp-nouveau/js/buddypress-messages.js

    diff --git src/bp-templates/bp-nouveau/js/buddypress-messages.js src/bp-templates/bp-nouveau/js/buddypress-messages.js
    index e706a69f7..c1ddaba16 100644
    window.bp = window.bp || {}; 
    639639                tagName   : 'div',
    640640
    641641                events: {
    642                         'click .thread-content'       : 'changePreview',
    643                         'dblclick .thread-content'    : 'loadSingleView'
     642                        'click .thread-content'    : 'changePreview',
     643                        'dblclick .thread-content' : 'loadSingleView',
     644                        'focus .thread-item'       : 'focusIn',
     645                        'keydown .thread-item'     : 'keyDown'
    644646                },
    645647
    646648                initialize: function() {
    window.bp = window.bp || {}; 
    671673
    672674                threadsFetched: function() {
    673675                        bp.Nouveau.Messages.removeFeedback();
     676
     677                        // Inform the user about how to use the UI.
     678                        bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howto, 'info' );
    674679                },
    675680
    676681                threadsFetchError: function( collection, response ) {
    window.bp = window.bp || {}; 
    693698                        this.views.add( '#message-threads', new bp.Views.userThread( { model: thread } ) );
    694699                },
    695700
     701                getActiveThread: function() {
     702                        var activeThread = this.collection.findWhere( { active: true } );
     703
     704                        if ( ! activeThread.get( 'id' ) ) {
     705                                return false;
     706                        }
     707
     708                        return activeThread;
     709                },
     710
     711                setActiveThread: function( active ) {
     712                        if ( ! active ) {
     713                                return;
     714                        }
     715
     716                        _.each( this.collection.models, function( thread ) {
     717                                if ( thread.id === active ) {
     718                                        thread.set( 'active', true );
     719                                } else {
     720                                         thread.unset( 'active' );
     721                                }
     722                        }, this );
     723                },
     724
    696725                changePreview: function( event ) {
    697726                        var target = $( event.currentTarget );
    698727
    window.bp = window.bp || {}; 
    701730                        }
    702731
    703732                        event.preventDefault();
     733                        bp.Nouveau.Messages.removeFeedback();
    704734
    705735                        if ( target.parent( 'li' ).hasClass( 'selected' ) ) {
    706736                                return;
    707737                        }
    708738
    709                         var selected = target.data( 'thread-id' );
    710 
    711                         _.each( this.collection.models, function( thread ) {
    712                                 if ( thread.id === selected ) {
    713                                         thread.set( 'active', true );
    714                                 } else {
    715                                         thread.unset( 'active' );
    716                                 }
    717                         }, this );
     739                        this.setActiveThread( target.data( 'thread-id' ) );
    718740                },
    719741
    720742                loadSingleView: function( event ) {
    window.bp = window.bp || {}; 
    729751                        var id = target.data( 'thread-id' );
    730752
    731753                        bp.Nouveau.Messages.router.navigate( 'view/' + id, { trigger: true } );
     754                },
     755
     756                focusIn: function( event ) {
     757                        if ( ! $( event.currentTarget ).hasClass( 'thread-item' ) || $( event.currentTarget ).hasClass( 'selected' ) ) {
     758                                return;
     759                        }
     760
     761                        var threadId = $( event.currentTarget ).find( '.thread-content' ).first().data( 'thread-id' );
     762
     763                        if ( threadId ) {
     764                                bp.Nouveau.Messages.removeFeedback();
     765                                this.setActiveThread( threadId );
     766                        }
     767                },
     768
     769                keyDown: function( event ) {
     770                        if ( ! $( event.currentTarget ).hasClass( 'thread-item' ) && ! $( event.currentTarget ).hasClass( 'selected' ) ) {
     771                                return;
     772                        }
     773
     774                        // Catch enter and space events
     775                        if ( 'keydown' === event.type && 13 !== event.keyCode && 32 !== event.keyCode ) {
     776                                return;
     777                        }
     778
     779                        event.preventDefault();
     780
     781                        var thread = this.getActiveThread();
     782
     783                        if ( ! _.isNumber( thread.get( 'id' ) ) ) {
     784                                return;
     785                        }
     786
     787                        bp.Nouveau.Messages.router.navigate( 'view/' + thread.get( 'id' ), { trigger: true } );
    732788                }
    733789        } );
    734790
    window.bp = window.bp || {}; 
    737793                template  : bp.template( 'bp-messages-thread' ),
    738794                className : 'thread-item',
    739795
     796                attributes: {
     797                        'tabIndex': 0
     798                },
     799
    740800                events: {
    741801                        'click .message-check' : 'singleSelect'
    742802                },
    window.bp = window.bp || {}; 
    794854
    795855                        if ( hasChecked ) {
    796856                                $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).removeClass( 'bp-hide' );
     857
     858                                // Inform the user about how to use the bulk actions.
     859                                bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howtoBulk, 'info' );
    797860                        } else {
    798861                                $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).addClass( 'bp-hide' );
     862
     863                                bp.Nouveau.Messages.removeFeedback();
    799864                        }
    800865                },
    801866
    window.bp = window.bp || {}; 
    925990
    926991                        if ( isChecked ) {
    927992                                $( this.el ).find( '.bulk-actions-wrap' ).removeClass( 'bp-hide' ).addClass( 'bp-show' );
     993
     994                                // Inform the user about how to use the bulk actions.
     995                                bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howtoBulk, 'info' );
    928996                        } else {
    929997                                $( this.el ).find( '.bulk-actions-wrap' ).addClass( 'bp-hide' );
     998
     999                                bp.Nouveau.Messages.removeFeedback();
    9301000                        }
    9311001
    9321002                        _.each( this.collection.models, function( model ) {
  • src/bp-templates/bp-nouveau/sass/_nouveau_messages.scss

    diff --git src/bp-templates/bp-nouveau/sass/_nouveau_messages.scss src/bp-templates/bp-nouveau/sass/_nouveau_messages.scss
    index 89747071c..5b8330c20 100644
     
    133133                        }
    134134                }
    135135
     136                // the unread parent li
     137                &.unread {
     138                        font-weight: bold;
     139                }
     140
    136141                .thread-content {
    137142                        cursor: pointer;
    138143