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 { |
3004 | 3004 | background-color: #fafafa; |
3005 | 3005 | } |
3006 | 3006 | |
| 3007 | #message-threads li.unread { |
| 3008 | font-weight: bold; |
| 3009 | } |
| 3010 | |
3007 | 3011 | #message-threads li.selected .thread-subject .subject { |
3008 | 3012 | color: #5087e5; |
3009 | 3013 | } |
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 { |
3004 | 3004 | background-color: #fafafa; |
3005 | 3005 | } |
3006 | 3006 | |
| 3007 | #message-threads li.unread { |
| 3008 | font-weight: bold; |
| 3009 | } |
| 3010 | |
3007 | 3011 | #message-threads li.selected .thread-subject .subject { |
3008 | 3012 | color: #5087e5; |
3009 | 3013 | } |
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() ) { |
99 | 99 | 'send' => wp_create_nonce( 'messages_send_message' ), |
100 | 100 | ), |
101 | 101 | '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 ✓ button to apply.', 'buddypress' ) . '</p></div>', |
102 | 107 | 'bulk_actions' => bp_nouveau_messages_get_bulk_actions(), |
103 | 108 | ); |
104 | 109 | |
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 || {}; |
639 | 639 | tagName : 'div', |
640 | 640 | |
641 | 641 | 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' |
644 | 646 | }, |
645 | 647 | |
646 | 648 | initialize: function() { |
… |
… |
window.bp = window.bp || {}; |
671 | 673 | |
672 | 674 | threadsFetched: function() { |
673 | 675 | 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' ); |
674 | 679 | }, |
675 | 680 | |
676 | 681 | threadsFetchError: function( collection, response ) { |
… |
… |
window.bp = window.bp || {}; |
693 | 698 | this.views.add( '#message-threads', new bp.Views.userThread( { model: thread } ) ); |
694 | 699 | }, |
695 | 700 | |
| 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 | |
696 | 725 | changePreview: function( event ) { |
697 | 726 | var target = $( event.currentTarget ); |
698 | 727 | |
… |
… |
window.bp = window.bp || {}; |
701 | 730 | } |
702 | 731 | |
703 | 732 | event.preventDefault(); |
| 733 | bp.Nouveau.Messages.removeFeedback(); |
704 | 734 | |
705 | 735 | if ( target.parent( 'li' ).hasClass( 'selected' ) ) { |
706 | 736 | return; |
707 | 737 | } |
708 | 738 | |
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' ) ); |
718 | 740 | }, |
719 | 741 | |
720 | 742 | loadSingleView: function( event ) { |
… |
… |
window.bp = window.bp || {}; |
729 | 751 | var id = target.data( 'thread-id' ); |
730 | 752 | |
731 | 753 | 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 } ); |
732 | 788 | } |
733 | 789 | } ); |
734 | 790 | |
… |
… |
window.bp = window.bp || {}; |
737 | 793 | template : bp.template( 'bp-messages-thread' ), |
738 | 794 | className : 'thread-item', |
739 | 795 | |
| 796 | attributes: { |
| 797 | 'tabIndex': 0 |
| 798 | }, |
| 799 | |
740 | 800 | events: { |
741 | 801 | 'click .message-check' : 'singleSelect' |
742 | 802 | }, |
… |
… |
window.bp = window.bp || {}; |
794 | 854 | |
795 | 855 | if ( hasChecked ) { |
796 | 856 | $( '#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' ); |
797 | 860 | } else { |
798 | 861 | $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).addClass( 'bp-hide' ); |
| 862 | |
| 863 | bp.Nouveau.Messages.removeFeedback(); |
799 | 864 | } |
800 | 865 | }, |
801 | 866 | |
… |
… |
window.bp = window.bp || {}; |
925 | 990 | |
926 | 991 | if ( isChecked ) { |
927 | 992 | $( 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' ); |
928 | 996 | } else { |
929 | 997 | $( this.el ).find( '.bulk-actions-wrap' ).addClass( 'bp-hide' ); |
| 998 | |
| 999 | bp.Nouveau.Messages.removeFeedback(); |
930 | 1000 | } |
931 | 1001 | |
932 | 1002 | _.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..5b8330c20 100644
|
|
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
| 136 | // the unread parent li |
| 137 | &.unread { |
| 138 | font-weight: bold; |
| 139 | } |
| 140 | |
136 | 141 | .thread-content { |
137 | 142 | cursor: pointer; |
138 | 143 | |