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
|
|
|
|
| 122 | 122 | <script type="text/html" id="tmpl-bp-messages-thread"> |
| 123 | 123 | <div class="thread-cb"> |
| 124 | 124 | <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> |
| 126 | 126 | </div> |
| 127 | 127 | <div class="thread-from"> |
| 128 | 128 | <a class="user-link" href="{{data.sender_link}}"> |
| 129 | 129 | <img class="avatar" src="{{data.sender_avatar}}" alt="" /> |
| 130 | 130 | <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> |
| 131 | 132 | </a> |
| 132 | 133 | </div> |
| 133 | 134 | <div class="thread-content" data-thread-id="{{data.id}}"> |
| 134 | | <div class="thread-subject"> |
| | 135 | <div class="thread-subject" tabindex="0"> |
| 135 | 136 | <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> |
| 137 | 139 | </div> |
| 138 | | <p class="excerpt"><# print( data.excerpt ); #></p> |
| | 140 | <p class="excerpt">{{data.excerpt}}</p> |
| 139 | 141 | </div> |
| 140 | 142 | <div class="thread-date"> |
| 141 | 143 | <time datetime="{{data.date.toISOString()}}">{{data.display_date}}</time> |
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 { |
| 2989 | 2989 | line-height: 1.1; |
| 2990 | 2990 | } |
| 2991 | 2991 | |
| | 2992 | #message-threads li .thread-subject:focus { |
| | 2993 | border: 1px dotted #333; |
| | 2994 | } |
| | 2995 | |
| 2992 | 2996 | #message-threads li .thread-content { |
| 2993 | 2997 | -webkit-flex: 1 2 60%; |
| 2994 | 2998 | -moz-flex: 1 2 60%; |
| … |
… |
body.register .buddypress-wrap .page ul { |
| 3009 | 3013 | background-color: #fafafa; |
| 3010 | 3014 | } |
| 3011 | 3015 | |
| | 3016 | #message-threads li.unread { |
| | 3017 | font-weight: 700; |
| | 3018 | } |
| | 3019 | |
| 3012 | 3020 | #message-threads li.selected .thread-subject .subject { |
| 3013 | 3021 | color: #5087e5; |
| 3014 | 3022 | } |
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 { |
| 2989 | 2989 | line-height: 1.1; |
| 2990 | 2990 | } |
| 2991 | 2991 | |
| | 2992 | #message-threads li .thread-subject:focus { |
| | 2993 | border: 1px dotted #333; |
| | 2994 | } |
| | 2995 | |
| 2992 | 2996 | #message-threads li .thread-content { |
| 2993 | 2997 | -webkit-flex: 1 2 60%; |
| 2994 | 2998 | -moz-flex: 1 2 60%; |
| … |
… |
body.register .buddypress-wrap .page ul { |
| 3009 | 3013 | background-color: #fafafa; |
| 3010 | 3014 | } |
| 3011 | 3015 | |
| | 3016 | #message-threads li.unread { |
| | 3017 | font-weight: 700; |
| | 3018 | } |
| | 3019 | |
| 3012 | 3020 | #message-threads li.selected .thread-subject .subject { |
| 3013 | 3021 | color: #5087e5; |
| 3014 | 3022 | } |
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() ) { |
| 98 | 98 | 'nonces' => array( |
| 99 | 99 | 'send' => wp_create_nonce( 'messages_send_message' ), |
| 100 | 100 | ), |
| 101 | | 'loading' => __( 'Loading messages. Please wait.', 'buddypress' ), |
| | 101 | 'loading' => __( 'Loading messages. Please wait.', 'buddypress' ), |
| 102 | 102 | '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 ✓ button to apply.', 'buddypress' ), |
| 103 | 105 | ); |
| 104 | 106 | |
| 105 | 107 | // Star private messages. |
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 || {}; |
| 634 | 634 | tagName : 'div', |
| 635 | 635 | |
| 636 | 636 | 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' |
| 639 | 641 | }, |
| 640 | 642 | |
| 641 | 643 | initialize: function() { |
| … |
… |
window.bp = window.bp || {}; |
| 666 | 668 | |
| 667 | 669 | threadsFetched: function() { |
| 668 | 670 | 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' ); |
| 669 | 674 | }, |
| 670 | 675 | |
| 671 | 676 | threadsFetchError: function( collection, response ) { |
| … |
… |
window.bp = window.bp || {}; |
| 688 | 693 | this.views.add( '#message-threads', new bp.Views.userThread( { model: thread } ) ); |
| 689 | 694 | }, |
| 690 | 695 | |
| | 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 | |
| 691 | 720 | changePreview: function( event ) { |
| 692 | 721 | var target = $( event.currentTarget ); |
| 693 | 722 | |
| … |
… |
window.bp = window.bp || {}; |
| 696 | 725 | } |
| 697 | 726 | |
| 698 | 727 | event.preventDefault(); |
| | 728 | bp.Nouveau.Messages.removeFeedback(); |
| 699 | 729 | |
| 700 | 730 | if ( target.parent( 'li' ).hasClass( 'selected' ) ) { |
| 701 | 731 | return; |
| 702 | 732 | } |
| 703 | 733 | |
| 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' ) ); |
| 713 | 735 | }, |
| 714 | 736 | |
| 715 | 737 | loadSingleView: function( event ) { |
| … |
… |
window.bp = window.bp || {}; |
| 724 | 746 | var id = target.data( 'thread-id' ); |
| 725 | 747 | |
| 726 | 748 | 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 } ); |
| 727 | 783 | } |
| 728 | 784 | } ); |
| 729 | 785 | |
| … |
… |
window.bp = window.bp || {}; |
| 732 | 788 | template : bp.template( 'bp-messages-thread' ), |
| 733 | 789 | className : 'thread-item', |
| 734 | 790 | |
| | 791 | attributes: { |
| | 792 | 'tabIndex': 0 |
| | 793 | }, |
| | 794 | |
| 735 | 795 | events: { |
| 736 | 796 | 'click .message-check' : 'singleSelect' |
| 737 | 797 | }, |
| … |
… |
window.bp = window.bp || {}; |
| 789 | 849 | |
| 790 | 850 | if ( hasChecked ) { |
| 791 | 851 | $( '#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' ); |
| 792 | 855 | } else { |
| 793 | 856 | $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).addClass( 'bp-hide' ); |
| | 857 | |
| | 858 | bp.Nouveau.Messages.removeFeedback(); |
| 794 | 859 | } |
| 795 | 860 | }, |
| 796 | 861 | |
| … |
… |
window.bp = window.bp || {}; |
| 920 | 985 | |
| 921 | 986 | if ( isChecked ) { |
| 922 | 987 | $( 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' ); |
| 923 | 991 | } else { |
| 924 | 992 | $( this.el ).find( '.bulk-actions-wrap' ).addClass( 'bp-hide' ); |
| | 993 | |
| | 994 | bp.Nouveau.Messages.removeFeedback(); |
| 925 | 995 | } |
| 926 | 996 | |
| 927 | 997 | _.each( this.collection.models, function( model ) { |
diff --git src/bp-templates/bp-nouveau/sass/_nouveau_messages.scss src/bp-templates/bp-nouveau/sass/_nouveau_messages.scss
index 89747071c..fed65ec9f 100644
|
|
|
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
| | 114 | .thread-subject:focus { |
| | 115 | border: 1px dotted $black; |
| | 116 | } |
| | 117 | |
| 114 | 118 | .thread-content { |
| 115 | 119 | |
| 116 | 120 | @include box-item-size(1, 2, 60%); |
| … |
… |
|
| 133 | 137 | } |
| 134 | 138 | } |
| 135 | 139 | |
| | 140 | // the unread parent li |
| | 141 | &.unread { |
| | 142 | font-weight: 700; |
| | 143 | } |
| | 144 | |
| 136 | 145 | .thread-content { |
| 137 | 146 | cursor: pointer; |
| 138 | 147 | |