Skip to:
Content

BuddyPress.org

Ticket #7731: 7731.patch

File 7731.patch, 7.1 KB (added by imath, 8 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 eb9ad5d0d..e8b40f840 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"></span><p>' . __( 'Loading messages. Please wait.', 'buddypress' ) . '</p></div>',
     102                'howto' => '<div class="bp-feedback info"><span class="bp-icon"></span><p>' .
     103                        __( 'Click on the message title to preview a message. Double click on the message title to open the full conversation.', 'buddypress' ) .
     104                        __( 'Use ctrl+d or ctrl+u to toggle the message preview down or up in the list. Use ctrl+enter to open a selected conversation.', 'buddypress' ) .
     105                        '</p></div>',
    102106                'bulk_actions' => bp_nouveau_messages_get_bulk_actions(),
     107                'howtoBulk' => '<div class="bp-feedback info"><span class="bp-icon"></span><p>' . __( 'Use the select box to define your bulk action and click on the &#10003; button to apply.', 'buddypress' ) . '</p></div>',
    103108        );
    104109
    105110        // Star private messages.
  • 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..e5dbaf2af 100644
    window.bp = window.bp || {}; 
    365365                        } );
    366366
    367367                        return bp.ajax.send( options );
     368                },
     369
     370                /**
     371                 * Get the "at" index for a model satisfying the requested attribute.
     372                 *
     373                 * @param  {object} attribute An object containing the attribute key and value.
     374                 * @return {integer}          The "at" position into the collection.
     375                 */
     376                getAt: function( attribute ) {
     377                        var key = _.first( _.keys( attribute ) ),
     378                            at = -1;
     379
     380                        _.each( this.models, function( model, index ) {
     381                                if ( attribute[ key ] === model.get( key ) ) {
     382                                        at = index;
     383                                }
     384                        } );
     385
     386                        return at;
    368387                }
    369388        } );
    370389
    window.bp = window.bp || {}; 
    655674
    656675                        this.collection.on( 'reset', this.cleanContent, this );
    657676                        this.collection.on( 'add', this.addThread, this );
     677
     678                        $( document ).on( 'keydown', _.bind( this.keyAction, this ) );
    658679                },
    659680
    660681                requestThreads: function() {
    window.bp = window.bp || {}; 
    671692
    672693                threadsFetched: function() {
    673694                        bp.Nouveau.Messages.removeFeedback();
     695
     696                        bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howto, 'info' );
    674697                },
    675698
    676699                threadsFetchError: function( collection, response ) {
    window.bp = window.bp || {}; 
    693716                        this.views.add( '#message-threads', new bp.Views.userThread( { model: thread } ) );
    694717                },
    695718
     719                setActiveThread: function( active ) {
     720                        if ( ! active ) {
     721                                return;
     722                        }
     723
     724                        _.each( this.collection.models, function( thread ) {
     725                                if ( thread.id === active ) {
     726                                        thread.set( 'active', true );
     727                                } else {
     728                                        thread.unset( 'active' );
     729                                }
     730                        }, this );
     731                },
     732
    696733                changePreview: function( event ) {
    697734                        var target = $( event.currentTarget );
    698735
    window.bp = window.bp || {}; 
    701738                        }
    702739
    703740                        event.preventDefault();
     741                        bp.Nouveau.Messages.removeFeedback();
    704742
    705743                        if ( target.parent( 'li' ).hasClass( 'selected' ) ) {
    706744                                return;
    707745                        }
    708746
    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 );
     747                        this.setActiveThread( target.data( 'thread-id' ) );
    718748                },
    719749
    720750                loadSingleView: function( event ) {
    window.bp = window.bp || {}; 
    729759                        var id = target.data( 'thread-id' );
    730760
    731761                        bp.Nouveau.Messages.router.navigate( 'view/' + id, { trigger: true } );
     762                },
     763
     764                keyAction: function( event ) {
     765                        if ( ! event.ctrlKey ) {
     766                                return;
     767                        }
     768
     769                        // Catch enter/arrow events
     770                        if ( 13 !== event.keyCode && 68 !== event.keyCode && 85 !== event.keyCode ) {
     771                                return;
     772                        }
     773
     774                        var model;
     775                        bp.Nouveau.Messages.removeFeedback();
     776
     777                        if ( 13 === event.keyCode ) {
     778                                model = _.find( this.collection.models, function( model ) {
     779                                        return true === model.get( 'active' );
     780                                } );
     781
     782                                if ( ! model.get( 'id' ) ) {
     783                                        return;
     784                                }
     785
     786                                bp.Nouveau.Messages.router.navigate( 'view/' + model.get( 'id' ), { trigger: true } );
     787                        } else {
     788                                var active = this.collection.getAt( { active: true } ), unactivate = active;
     789
     790                                if ( 85 === event.keyCode ) {
     791                                        active -= 1;
     792                                } else {
     793                                        active +=1;
     794                                }
     795
     796                                if ( active >= 0 && active < this.collection.length && unactivate !== active ) {
     797                                        model = this.collection.at( active );
     798                                        this.setActiveThread( model.get( 'id' ) );
     799                                }
     800                        }
    732801                }
    733802        } );
    734803
    window.bp = window.bp || {}; 
    794863
    795864                        if ( hasChecked ) {
    796865                                $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).removeClass( 'bp-hide' );
     866
     867                                bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howtoBulk, 'info' );
    797868                        } else {
    798869                                $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).addClass( 'bp-hide' );
     870
     871                                bp.Nouveau.Messages.removeFeedback();
    799872                        }
    800873                },
    801874
    window.bp = window.bp || {}; 
    925998
    926999                        if ( isChecked ) {
    9271000                                $( this.el ).find( '.bulk-actions-wrap' ).removeClass( 'bp-hide' ).addClass( 'bp-show' );
     1001
     1002                                bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howtoBulk, 'info' );
    9281003                        } else {
    9291004                                $( this.el ).find( '.bulk-actions-wrap' ).addClass( 'bp-hide' );
     1005
     1006                                bp.Nouveau.Messages.removeFeedback();
    9301007                        }
    9311008
    9321009                        _.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