Skip to:
Content

BuddyPress.org

Ticket #7731: 7731.03.patch

File 7731.03.patch, 9.4 KB (added by imath, 8 years ago)
  • src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php

    diff --git src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php
    index a5eade58f..4f43be097 100644
     
    122122<script type="text/html" id="tmpl-bp-messages-thread">
    123123        <div class="thread-cb">
    124124                <input class="message-check" type="checkbox" name="message_ids[]" id="bp-message-thread-{{data.id}}" value="{{data.id}}">
    125                 <label for="bp-message-thread-{{data.id}}" class="bp-screen-reader-text"><?php esc_html_e( 'Select this message', 'buddypress' ); ?></label>
     125                <label for="bp-message-thread-{{data.id}}" class="bp-screen-reader-text"><?php esc_html_e( 'Select message:', 'buddypress' ); ?> {{data.subject}}</label>
    126126        </div>
    127127        <div class="thread-from">
    128128                <a class="user-link" href="{{data.sender_link}}">
    129129                        <img class="avatar" src="{{data.sender_avatar}}" alt="" />
    130130                        <span class="user-name">{{data.sender_name}}</span>
     131                        <span class="bp-screen-reader-text"><?php esc_html_e( 'From:', 'buddypress' ); ?> {{data.sender_name}}</span>
    131132                </a>
    132133        </div>
    133134        <div class="thread-content" data-thread-id="{{data.id}}">
    134                 <div class="thread-subject">
     135                <div class="thread-subject" tabindex="0">
    135136                        <span class="thread-count">({{data.count}})</span>
    136                         <span class="subject"><# print( data.subject ); #></span>
     137                        <span class="subject">{{data.subject}}</span>
     138                        <span class="bp-screen-reader-text">{{data.subject}}. <?php esc_html_e( 'Press <kbd>Enter</kbd> to view the full conversation.', 'buddypress' ); ?></span>
    137139                </div>
    138                 <p class="excerpt"><# print( data.excerpt ); #></p>
     140                <p class="excerpt">{{data.excerpt}}</p>
    139141        </div>
    140142        <div class="thread-date">
    141143                <time datetime="{{data.date.toISOString()}}">{{data.display_date}}</time>
  • 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 d3c2356a9..7396362d5 100644
    body.register .buddypress-wrap .page ul { 
    29892989        line-height: 1.1;
    29902990}
    29912991
     2992#message-threads li .thread-subject:focus {
     2993        border: 1px dotted #333;
     2994}
     2995
    29922996#message-threads li .thread-content {
    29932997        -webkit-flex: 1 2 60%;
    29942998        -moz-flex: 1 2 60%;
    body.register .buddypress-wrap .page ul { 
    30093013        background-color: #fafafa;
    30103014}
    30113015
     3016#message-threads li.unread {
     3017        font-weight: 700;
     3018}
     3019
    30123020#message-threads li.selected .thread-subject .subject {
    30133021        color: #5087e5;
    30143022}
  • 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 8762d5141..494cf7901 100644
    body.register .buddypress-wrap .page ul { 
    29892989        line-height: 1.1;
    29902990}
    29912991
     2992#message-threads li .thread-subject:focus {
     2993        border: 1px dotted #333;
     2994}
     2995
    29922996#message-threads li .thread-content {
    29932997        -webkit-flex: 1 2 60%;
    29942998        -moz-flex: 1 2 60%;
    body.register .buddypress-wrap .page ul { 
    30093013        background-color: #fafafa;
    30103014}
    30113015
     3016#message-threads li.unread {
     3017        font-weight: 700;
     3018}
     3019
    30123020#message-threads li.selected .thread-subject .subject {
    30133021        color: #5087e5;
    30143022}
  • 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 852637084..5265e1de4 100644
    function bp_nouveau_messages_localize_scripts( $params = array() ) { 
    9898                'nonces' => array(
    9999                        'send' => wp_create_nonce( 'messages_send_message' ),
    100100                ),
    101                 'loading' => __( 'Loading messages. Please wait.', 'buddypress' ),
     101                'loading'      => __( 'Loading messages. Please wait.', 'buddypress' ),
    102102                'bulk_actions' => bp_nouveau_messages_get_bulk_actions(),
     103                'howto'        => __( '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                'howtoBulk'    => __( 'Use the select box to define your bulk action and click on the &#10003; button to apply.', 'buddypress' ),
    103105        );
    104106
    105107        // 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 9ec7218ef..55a41d27e 100644
    window.bp = window.bp || {}; 
    634634                tagName   : 'div',
    635635
    636636                events: {
    637                         'click .thread-content'       : 'changePreview',
    638                         'dblclick .thread-content'    : 'loadSingleView'
     637                        'click .thread-content'    : 'changePreview',
     638                        'dblclick .thread-content' : 'loadSingleView',
     639                        'focus .thread-item'       : 'focusIn',
     640                        'keydown .thread-subject'  : 'keyDown'
    639641                },
    640642
    641643                initialize: function() {
    window.bp = window.bp || {}; 
    666668
    667669                threadsFetched: function() {
    668670                        bp.Nouveau.Messages.removeFeedback();
     671
     672                        // Inform the user about how to use the UI.
     673                        bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howto, 'info' );
    669674                },
    670675
    671676                threadsFetchError: function( collection, response ) {
    window.bp = window.bp || {}; 
    688693                        this.views.add( '#message-threads', new bp.Views.userThread( { model: thread } ) );
    689694                },
    690695
     696                getActiveThread: function() {
     697                        var activeThread = this.collection.findWhere( { active: true } );
     698
     699                        if ( ! activeThread.get( 'id' ) ) {
     700                                return false;
     701                        }
     702
     703                        return activeThread;
     704                },
     705
     706                setActiveThread: function( active ) {
     707                        if ( ! active ) {
     708                                return;
     709                        }
     710
     711                        _.each( this.collection.models, function( thread ) {
     712                                if ( thread.id === active ) {
     713                                        thread.set( 'active', true );
     714                                } else {
     715                                         thread.unset( 'active' );
     716                                }
     717                        }, this );
     718                },
     719
    691720                changePreview: function( event ) {
    692721                        var target = $( event.currentTarget );
    693722
    window.bp = window.bp || {}; 
    696725                        }
    697726
    698727                        event.preventDefault();
     728                        bp.Nouveau.Messages.removeFeedback();
    699729
    700730                        if ( target.parent( 'li' ).hasClass( 'selected' ) ) {
    701731                                return;
    702732                        }
    703733
    704                         var selected = target.data( 'thread-id' );
    705 
    706                         _.each( this.collection.models, function( thread ) {
    707                                 if ( thread.id === selected ) {
    708                                         thread.set( 'active', true );
    709                                 } else {
    710                                         thread.unset( 'active' );
    711                                 }
    712                         }, this );
     734                        this.setActiveThread( target.data( 'thread-id' ) );
    713735                },
    714736
    715737                loadSingleView: function( event ) {
    window.bp = window.bp || {}; 
    724746                        var id = target.data( 'thread-id' );
    725747
    726748                        bp.Nouveau.Messages.router.navigate( 'view/' + id, { trigger: true } );
     749                },
     750
     751                focusIn: function( event ) {
     752                        if ( ! $( event.currentTarget ).hasClass( 'thread-item' ) || $( event.currentTarget ).hasClass( 'selected' ) ) {
     753                                return;
     754                        }
     755
     756                        var threadId = $( event.currentTarget ).find( '.thread-content' ).first().data( 'thread-id' );
     757
     758                        if ( threadId ) {
     759                                bp.Nouveau.Messages.removeFeedback();
     760                                this.setActiveThread( threadId );
     761                        }
     762                },
     763
     764                keyDown: function( event ) {
     765                        if ( ! $( event.currentTarget ).hasClass( 'thread-subject' ) && ! $( event.currentTarget ).closest( '.thread-item' ).hasClass( 'selected' ) ) {
     766                                return;
     767                        }
     768
     769                        // Catch enter and space events
     770                        if ( 'keydown' === event.type && 13 !== event.keyCode && 32 !== event.keyCode ) {
     771                                return;
     772                        }
     773
     774                        event.preventDefault();
     775
     776                        var thread = this.getActiveThread();
     777
     778                        if ( ! _.isNumber( thread.get( 'id' ) ) ) {
     779                                return;
     780                        }
     781
     782                        bp.Nouveau.Messages.router.navigate( 'view/' + thread.get( 'id' ), { trigger: true } );
    727783                }
    728784        } );
    729785
    window.bp = window.bp || {}; 
    732788                template  : bp.template( 'bp-messages-thread' ),
    733789                className : 'thread-item',
    734790
     791                attributes: {
     792                        'tabIndex': 0
     793                },
     794
    735795                events: {
    736796                        'click .message-check' : 'singleSelect'
    737797                },
    window.bp = window.bp || {}; 
    789849
    790850                        if ( hasChecked ) {
    791851                                $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).removeClass( 'bp-hide' );
     852
     853                                // Inform the user about how to use the bulk actions.
     854                                bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howtoBulk, 'info' );
    792855                        } else {
    793856                                $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).addClass( 'bp-hide' );
     857
     858                                bp.Nouveau.Messages.removeFeedback();
    794859                        }
    795860                },
    796861
    window.bp = window.bp || {}; 
    920985
    921986                        if ( isChecked ) {
    922987                                $( this.el ).find( '.bulk-actions-wrap' ).removeClass( 'bp-hide' ).addClass( 'bp-show' );
     988
     989                                // Inform the user about how to use the bulk actions.
     990                                bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howtoBulk, 'info' );
    923991                        } else {
    924992                                $( this.el ).find( '.bulk-actions-wrap' ).addClass( 'bp-hide' );
     993
     994                                bp.Nouveau.Messages.removeFeedback();
    925995                        }
    926996
    927997                        _.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..fed65ec9f 100644
     
    111111                        }
    112112                }
    113113
     114                .thread-subject:focus {
     115                        border: 1px dotted $black;
     116                }
     117
    114118                .thread-content {
    115119
    116120                        @include box-item-size(1, 2, 60%);
     
    133137                        }
    134138                }
    135139
     140                // the unread parent li
     141                &.unread {
     142                        font-weight: 700;
     143                }
     144
    136145                .thread-content {
    137146                        cursor: pointer;
    138147