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 5e877b442..6695e4d6e 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> |
| 126 | | </div> |
| 127 | | <div class="thread-from"> |
| 128 | | <a class="user-link" href="{{data.sender_link}}"> |
| 129 | | <img class="avatar" src="{{data.sender_avatar}}" alt="" /> |
| 130 | | <span class="user-name">{{data.sender_name}}</span> |
| 131 | | </a> |
| | 125 | <label for="bp-message-thread-{{data.id}}" class="bp-screen-reader-text"><?php esc_html_e( 'Select message:', 'buddypress' ); ?> {{data.subject}}</label> |
| 132 | 126 | </div> |
| | 127 | |
| | 128 | <# if ( ! data.recipientsCount ) { #> |
| | 129 | <div class="thread-from"> |
| | 130 | <a class="user-link" href="{{data.sender_link}}"> |
| | 131 | <img class="avatar" src="{{data.sender_avatar}}" alt="" /> |
| | 132 | <span class="bp-screen-reader-text"><?php esc_html_e( 'From:', 'buddypress' ); ?></span> |
| | 133 | <span class="user-name">{{data.sender_name}}</span> |
| | 134 | </a> |
| | 135 | </div> |
| | 136 | <# } else { |
| | 137 | var recipient = _.first( data.recipients ); |
| | 138 | #> |
| | 139 | <div class="thread-to"> |
| | 140 | <a class="user-link" href="{{recipient.user_link}}"> |
| | 141 | <img class="avatar" src="{{recipient.avatar}}" alt="" /> |
| | 142 | <span class="bp-screen-reader-text"><?php esc_html_e( 'To:', 'buddypress' ); ?></span> |
| | 143 | <span class="user-name">{{recipient.user_name}}</span> |
| | 144 | </a> |
| | 145 | |
| | 146 | <# if ( data.toOthers ) { #> |
| | 147 | <span class="num-recipients">{{data.toOthers}}</span> |
| | 148 | <# } #> |
| | 149 | </div> |
| | 150 | <# } #> |
| | 151 | |
| 133 | 152 | <div class="thread-content" data-thread-id="{{data.id}}"> |
| 134 | 153 | <div class="thread-subject"> |
| 135 | 154 | <span class="thread-count">({{data.count}})</span> |
| 136 | | <span class="subject"><# print( data.subject ); #></span> |
| | 155 | <a class="subject" href="#view/{{data.id}}"> |
| | 156 | {{data.subject}} |
| | 157 | <span class="bp-screen-reader-text"><?php esc_html_e( 'Press Enter to view the full conversation.', 'buddypress' ); ?></span> |
| | 158 | </a> |
| 137 | 159 | </div> |
| 138 | | <p class="excerpt"><# print( data.excerpt ); #></p> |
| | 160 | <p class="excerpt">{{data.excerpt}}</p> |
| 139 | 161 | </div> |
| 140 | 162 | <div class="thread-date"> |
| 141 | 163 | <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 74646f88a..668214e3c 100644
|
|
|
body.register .buddypress-wrap .page ul { |
| 2962 | 2962 | flex: 1 2 5%; |
| 2963 | 2963 | } |
| 2964 | 2964 | |
| 2965 | | #message-threads li .thread-from { |
| | 2965 | #message-threads li .thread-from, |
| | 2966 | #message-threads li .thread-to { |
| 2966 | 2967 | -webkit-flex: 1 2 20%; |
| 2967 | 2968 | -moz-flex: 1 2 20%; |
| 2968 | 2969 | -ms-flex: 1 2 20%; |
| … |
… |
body.register .buddypress-wrap .page ul { |
| 2970 | 2971 | flex: 1 2 20%; |
| 2971 | 2972 | } |
| 2972 | 2973 | |
| 2973 | | #message-threads li .thread-from img.avatar { |
| | 2974 | #message-threads li .thread-from img.avatar, |
| | 2975 | #message-threads li .thread-to img.avatar { |
| 2974 | 2976 | float: right; |
| 2975 | 2977 | margin: 0 0 0 10px; |
| 2976 | 2978 | } |
| 2977 | 2979 | |
| 2978 | | #message-threads li .thread-from .user-name { |
| | 2980 | #message-threads li .thread-from .user-name, |
| | 2981 | #message-threads li .thread-to .user-name { |
| 2979 | 2982 | display: inline-block; |
| 2980 | 2983 | line-height: 1.1; |
| 2981 | 2984 | } |
| 2982 | 2985 | |
| | 2986 | #message-threads li .thread-from .num-recipients, |
| | 2987 | #message-threads li .thread-to .num-recipients { |
| | 2988 | color: #737373; |
| | 2989 | font-weight: 400; |
| | 2990 | font-size: 12px; |
| | 2991 | margin: 0; |
| | 2992 | } |
| | 2993 | |
| 2983 | 2994 | #message-threads li .thread-content { |
| 2984 | 2995 | -webkit-flex: 1 2 60%; |
| 2985 | 2996 | -moz-flex: 1 2 60%; |
| … |
… |
body.register .buddypress-wrap .page ul { |
| 3000 | 3011 | background-color: #fafafa; |
| 3001 | 3012 | } |
| 3002 | 3013 | |
| | 3014 | #message-threads li.unread { |
| | 3015 | font-weight: 700; |
| | 3016 | } |
| | 3017 | |
| 3003 | 3018 | #message-threads li.selected .thread-subject .subject { |
| 3004 | 3019 | color: #5087e5; |
| 3005 | 3020 | } |
| … |
… |
body.register .buddypress-wrap .page ul { |
| 3015 | 3030 | } |
| 3016 | 3031 | |
| 3017 | 3032 | #message-threads li .thread-content .thread-from, |
| | 3033 | #message-threads li .thread-content .thread-to, |
| 3018 | 3034 | #message-threads li .thread-content .thread-subject { |
| 3019 | 3035 | font-size: 13px; |
| 3020 | 3036 | } |
| 3021 | 3037 | |
| 3022 | 3038 | @media screen and (min-width: 46.8em) { |
| 3023 | 3039 | #message-threads li .thread-content .thread-from, |
| | 3040 | #message-threads li .thread-content .thread-to, |
| 3024 | 3041 | #message-threads li .thread-content .thread-subject { |
| 3025 | 3042 | font-size: 16px; |
| 3026 | 3043 | } |
diff --git src/bp-templates/bp-nouveau/css/buddypress.css src/bp-templates/bp-nouveau/css/buddypress.css
index a98a5ad8c..857b29a00 100644
|
|
|
body.register .buddypress-wrap .page ul { |
| 2962 | 2962 | flex: 1 2 5%; |
| 2963 | 2963 | } |
| 2964 | 2964 | |
| 2965 | | #message-threads li .thread-from { |
| | 2965 | #message-threads li .thread-from, |
| | 2966 | #message-threads li .thread-to { |
| 2966 | 2967 | -webkit-flex: 1 2 20%; |
| 2967 | 2968 | -moz-flex: 1 2 20%; |
| 2968 | 2969 | -ms-flex: 1 2 20%; |
| … |
… |
body.register .buddypress-wrap .page ul { |
| 2970 | 2971 | flex: 1 2 20%; |
| 2971 | 2972 | } |
| 2972 | 2973 | |
| 2973 | | #message-threads li .thread-from img.avatar { |
| | 2974 | #message-threads li .thread-from img.avatar, |
| | 2975 | #message-threads li .thread-to img.avatar { |
| 2974 | 2976 | float: left; |
| 2975 | 2977 | margin: 0 10px 0 0; |
| 2976 | 2978 | } |
| 2977 | 2979 | |
| 2978 | | #message-threads li .thread-from .user-name { |
| | 2980 | #message-threads li .thread-from .user-name, |
| | 2981 | #message-threads li .thread-to .user-name { |
| 2979 | 2982 | display: inline-block; |
| 2980 | 2983 | line-height: 1.1; |
| 2981 | 2984 | } |
| 2982 | 2985 | |
| | 2986 | #message-threads li .thread-from .num-recipients, |
| | 2987 | #message-threads li .thread-to .num-recipients { |
| | 2988 | color: #737373; |
| | 2989 | font-weight: 400; |
| | 2990 | font-size: 12px; |
| | 2991 | margin: 0; |
| | 2992 | } |
| | 2993 | |
| 2983 | 2994 | #message-threads li .thread-content { |
| 2984 | 2995 | -webkit-flex: 1 2 60%; |
| 2985 | 2996 | -moz-flex: 1 2 60%; |
| … |
… |
body.register .buddypress-wrap .page ul { |
| 3000 | 3011 | background-color: #fafafa; |
| 3001 | 3012 | } |
| 3002 | 3013 | |
| | 3014 | #message-threads li.unread { |
| | 3015 | font-weight: 700; |
| | 3016 | } |
| | 3017 | |
| 3003 | 3018 | #message-threads li.selected .thread-subject .subject { |
| 3004 | 3019 | color: #5087e5; |
| 3005 | 3020 | } |
| … |
… |
body.register .buddypress-wrap .page ul { |
| 3008 | 3023 | cursor: pointer; |
| 3009 | 3024 | } |
| 3010 | 3025 | |
| 3011 | | #message-threads li .thread-content .excerpt { |
| | 3026 | #message-threads li .thread-content .excerpt, |
| | 3027 | #message-threads li .thread-content .num-recipients { |
| 3012 | 3028 | color: #737373; |
| 3013 | 3029 | font-size: 12px; |
| 3014 | 3030 | margin: 0; |
| 3015 | 3031 | } |
| 3016 | 3032 | |
| 3017 | 3033 | #message-threads li .thread-content .thread-from, |
| | 3034 | #message-threads li .thread-content .thread-to, |
| 3018 | 3035 | #message-threads li .thread-content .thread-subject { |
| 3019 | 3036 | font-size: 13px; |
| 3020 | 3037 | } |
| 3021 | 3038 | |
| 3022 | 3039 | @media screen and (min-width: 46.8em) { |
| 3023 | 3040 | #message-threads li .thread-content .thread-from, |
| | 3041 | #message-threads li .thread-content .thread-to, |
| 3024 | 3042 | #message-threads li .thread-content .thread-subject { |
| 3025 | 3043 | font-size: 16px; |
| 3026 | 3044 | } |
diff --git src/bp-templates/bp-nouveau/includes/messages/functions.php src/bp-templates/bp-nouveau/includes/messages/functions.php
index 5eebdc077..b7519e93e 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' ), |
| | 105 | 'toOthers' => array( |
| | 106 | 'one' => __( '(and 1 other)', 'buddypress' ), |
| | 107 | 'more' => __( '(and %d others)', 'buddypress' ), |
| | 108 | ), |
| 103 | 109 | ); |
| 104 | 110 | |
| 105 | 111 | // 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..c4aadeabb 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 .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 ).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 || {}; |
| 745 | 805 | this.el.className += ' unread'; |
| 746 | 806 | } |
| 747 | 807 | |
| | 808 | if ( 'sentbox' === bp.Nouveau.Messages.box ) { |
| | 809 | var recipientsCount = this.model.get( 'recipients' ).length, toOthers = ''; |
| | 810 | |
| | 811 | if ( 2 === recipientsCount ) { |
| | 812 | toOthers = BP_Nouveau.messages.toOthers.one; |
| | 813 | } else if ( 2 < recipientsCount ) { |
| | 814 | toOthers = BP_Nouveau.messages.toOthers.more.replace( '%d', Number( recipientsCount - 1 ) ); |
| | 815 | } |
| | 816 | |
| | 817 | this.model.set( { |
| | 818 | recipientsCount: recipientsCount, |
| | 819 | toOthers: toOthers |
| | 820 | }, { silent: true } ) |
| | 821 | } else if ( this.model.get( 'recipientsCount' ) ) { |
| | 822 | this.model.unset( 'recipientsCount', { silent: true } ); |
| | 823 | } |
| | 824 | |
| 748 | 825 | this.model.on( 'change:active', this.toggleClass, this ); |
| 749 | 826 | this.model.on( 'change:unread', this.updateReadState, this ); |
| 750 | 827 | this.model.on( 'change:checked', this.bulkSelect, this ); |
| … |
… |
window.bp = window.bp || {}; |
| 789 | 866 | |
| 790 | 867 | if ( hasChecked ) { |
| 791 | 868 | $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).removeClass( 'bp-hide' ); |
| | 869 | |
| | 870 | // Inform the user about how to use the bulk actions. |
| | 871 | bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howtoBulk, 'info' ); |
| 792 | 872 | } else { |
| 793 | 873 | $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).addClass( 'bp-hide' ); |
| | 874 | |
| | 875 | bp.Nouveau.Messages.removeFeedback(); |
| 794 | 876 | } |
| 795 | 877 | }, |
| 796 | 878 | |
| … |
… |
window.bp = window.bp || {}; |
| 920 | 1002 | |
| 921 | 1003 | if ( isChecked ) { |
| 922 | 1004 | $( this.el ).find( '.bulk-actions-wrap' ).removeClass( 'bp-hide' ).addClass( 'bp-show' ); |
| | 1005 | |
| | 1006 | // Inform the user about how to use the bulk actions. |
| | 1007 | bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howtoBulk, 'info' ); |
| 923 | 1008 | } else { |
| 924 | 1009 | $( this.el ).find( '.bulk-actions-wrap' ).addClass( 'bp-hide' ); |
| | 1010 | |
| | 1011 | bp.Nouveau.Messages.removeFeedback(); |
| 925 | 1012 | } |
| 926 | 1013 | |
| 927 | 1014 | _.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 a9a44a599..213f7ebea 100644
|
|
|
|
| 96 | 96 | @include box-item-size(1, 2, 5%); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | | .thread-from { |
| | 99 | .thread-from, |
| | 100 | .thread-to { |
| 100 | 101 | |
| 101 | 102 | @include box-item-size(1, 2, 20%); |
| 102 | 103 | |
| … |
… |
|
| 109 | 110 | display: inline-block; |
| 110 | 111 | line-height: 1.1; |
| 111 | 112 | } |
| | 113 | |
| | 114 | .num-recipients { |
| | 115 | color: $meta-text; |
| | 116 | font-weight: 400; |
| | 117 | @include font-size(12); |
| | 118 | margin: 0; |
| | 119 | } |
| 112 | 120 | } |
| 113 | 121 | |
| 114 | 122 | .thread-content { |
| … |
… |
|
| 133 | 141 | } |
| 134 | 142 | } |
| 135 | 143 | |
| | 144 | // the unread parent li |
| | 145 | &.unread { |
| | 146 | font-weight: 700; |
| | 147 | } |
| | 148 | |
| 136 | 149 | .thread-content { |
| 137 | 150 | cursor: pointer; |
| 138 | 151 | |
| … |
… |
|
| 144 | 157 | } |
| 145 | 158 | |
| 146 | 159 | .thread-from, |
| | 160 | .thread-to, |
| 147 | 161 | .thread-subject { |
| 148 | 162 | |
| 149 | 163 | @include responsive-font(16); |