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..33da9799e 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}}">{{data.subject}}</a> |
| 137 | 156 | </div> |
| 138 | | <p class="excerpt"><# print( data.excerpt ); #></p> |
| | 157 | <p class="excerpt">{{data.excerpt}}</p> |
| 139 | 158 | </div> |
| 140 | 159 | <div class="thread-date"> |
| 141 | 160 | <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 0720165ad..1751b9ad0 100644
|
|
|
body.register .buddypress-wrap .page ul { |
| 2963 | 2963 | flex: 1 2 5%; |
| 2964 | 2964 | } |
| 2965 | 2965 | |
| 2966 | | #message-threads li .thread-from { |
| | 2966 | #message-threads li .thread-from, |
| | 2967 | #message-threads li .thread-to { |
| 2967 | 2968 | -webkit-flex: 1 2 20%; |
| 2968 | 2969 | -moz-flex: 1 2 20%; |
| 2969 | 2970 | -ms-flex: 1 2 20%; |
| … |
… |
body.register .buddypress-wrap .page ul { |
| 2971 | 2972 | flex: 1 2 20%; |
| 2972 | 2973 | } |
| 2973 | 2974 | |
| 2974 | | #message-threads li .thread-from img.avatar { |
| | 2975 | #message-threads li .thread-from img.avatar, |
| | 2976 | #message-threads li .thread-to img.avatar { |
| 2975 | 2977 | float: right; |
| 2976 | 2978 | margin: 0 0 0 10px; |
| 2977 | 2979 | } |
| 2978 | 2980 | |
| 2979 | | #message-threads li .thread-from .user-name { |
| | 2981 | #message-threads li .thread-from .user-name, |
| | 2982 | #message-threads li .thread-to .user-name { |
| 2980 | 2983 | display: inline-block; |
| 2981 | 2984 | line-height: 1.1; |
| 2982 | 2985 | } |
| 2983 | 2986 | |
| | 2987 | #message-threads li .thread-from .num-recipients, |
| | 2988 | #message-threads li .thread-to .num-recipients { |
| | 2989 | color: #737373; |
| | 2990 | font-weight: 400; |
| | 2991 | font-size: 12px; |
| | 2992 | margin: 0; |
| | 2993 | } |
| | 2994 | |
| 2984 | 2995 | #message-threads li .thread-content { |
| 2985 | 2996 | -webkit-flex: 1 2 60%; |
| 2986 | 2997 | -moz-flex: 1 2 60%; |
| … |
… |
body.register .buddypress-wrap .page ul { |
| 3001 | 3012 | background-color: #fafafa; |
| 3002 | 3013 | } |
| 3003 | 3014 | |
| 3004 | | #message-threads li.selected .thread-subject .subject { |
| 3005 | | color: #5087e5; |
| | 3015 | #message-threads li.unread { |
| | 3016 | font-weight: 700; |
| 3006 | 3017 | } |
| 3007 | 3018 | |
| 3008 | | #message-threads li .thread-content { |
| 3009 | | cursor: pointer; |
| | 3019 | #message-threads li.selected .thread-subject .subject { |
| | 3020 | color: #5087e5; |
| 3010 | 3021 | } |
| 3011 | 3022 | |
| 3012 | 3023 | #message-threads li .thread-content .excerpt { |
| … |
… |
body.register .buddypress-wrap .page ul { |
| 3016 | 3027 | } |
| 3017 | 3028 | |
| 3018 | 3029 | #message-threads li .thread-content .thread-from, |
| | 3030 | #message-threads li .thread-content .thread-to, |
| 3019 | 3031 | #message-threads li .thread-content .thread-subject { |
| 3020 | 3032 | font-size: 13px; |
| 3021 | 3033 | } |
| 3022 | 3034 | |
| 3023 | 3035 | @media screen and (min-width: 46.8em) { |
| 3024 | 3036 | #message-threads li .thread-content .thread-from, |
| | 3037 | #message-threads li .thread-content .thread-to, |
| 3025 | 3038 | #message-threads li .thread-content .thread-subject { |
| 3026 | 3039 | font-size: 16px; |
| 3027 | 3040 | } |
diff --git src/bp-templates/bp-nouveau/css/buddypress.css src/bp-templates/bp-nouveau/css/buddypress.css
index 56ab9c300..49d97a790 100644
|
|
|
body.register .buddypress-wrap .page ul { |
| 2963 | 2963 | flex: 1 2 5%; |
| 2964 | 2964 | } |
| 2965 | 2965 | |
| 2966 | | #message-threads li .thread-from { |
| | 2966 | #message-threads li .thread-from, |
| | 2967 | #message-threads li .thread-to { |
| 2967 | 2968 | -webkit-flex: 1 2 20%; |
| 2968 | 2969 | -moz-flex: 1 2 20%; |
| 2969 | 2970 | -ms-flex: 1 2 20%; |
| … |
… |
body.register .buddypress-wrap .page ul { |
| 2971 | 2972 | flex: 1 2 20%; |
| 2972 | 2973 | } |
| 2973 | 2974 | |
| 2974 | | #message-threads li .thread-from img.avatar { |
| | 2975 | #message-threads li .thread-from img.avatar, |
| | 2976 | #message-threads li .thread-to img.avatar { |
| 2975 | 2977 | float: left; |
| 2976 | 2978 | margin: 0 10px 0 0; |
| 2977 | 2979 | } |
| 2978 | 2980 | |
| 2979 | | #message-threads li .thread-from .user-name { |
| | 2981 | #message-threads li .thread-from .user-name, |
| | 2982 | #message-threads li .thread-to .user-name { |
| 2980 | 2983 | display: inline-block; |
| 2981 | 2984 | line-height: 1.1; |
| 2982 | 2985 | } |
| 2983 | 2986 | |
| | 2987 | #message-threads li .thread-from .num-recipients, |
| | 2988 | #message-threads li .thread-to .num-recipients { |
| | 2989 | color: #737373; |
| | 2990 | font-weight: 400; |
| | 2991 | font-size: 12px; |
| | 2992 | margin: 0; |
| | 2993 | } |
| | 2994 | |
| 2984 | 2995 | #message-threads li .thread-content { |
| 2985 | 2996 | -webkit-flex: 1 2 60%; |
| 2986 | 2997 | -moz-flex: 1 2 60%; |
| … |
… |
body.register .buddypress-wrap .page ul { |
| 3001 | 3012 | background-color: #fafafa; |
| 3002 | 3013 | } |
| 3003 | 3014 | |
| 3004 | | #message-threads li.selected .thread-subject .subject { |
| 3005 | | color: #5087e5; |
| | 3015 | #message-threads li.unread { |
| | 3016 | font-weight: 700; |
| 3006 | 3017 | } |
| 3007 | 3018 | |
| 3008 | | #message-threads li .thread-content { |
| 3009 | | cursor: pointer; |
| | 3019 | #message-threads li.selected .thread-subject .subject { |
| | 3020 | color: #5087e5; |
| 3010 | 3021 | } |
| 3011 | 3022 | |
| 3012 | | #message-threads li .thread-content .excerpt { |
| | 3023 | #message-threads li .thread-content .excerpt, |
| | 3024 | #message-threads li .thread-content .num-recipients { |
| 3013 | 3025 | color: #737373; |
| 3014 | 3026 | font-size: 12px; |
| 3015 | 3027 | margin: 0; |
| 3016 | 3028 | } |
| 3017 | 3029 | |
| 3018 | 3030 | #message-threads li .thread-content .thread-from, |
| | 3031 | #message-threads li .thread-content .thread-to, |
| 3019 | 3032 | #message-threads li .thread-content .thread-subject { |
| 3020 | 3033 | font-size: 13px; |
| 3021 | 3034 | } |
| 3022 | 3035 | |
| 3023 | 3036 | @media screen and (min-width: 46.8em) { |
| 3024 | 3037 | #message-threads li .thread-content .thread-from, |
| | 3038 | #message-threads li .thread-content .thread-to, |
| 3025 | 3039 | #message-threads li .thread-content .thread-subject { |
| 3026 | 3040 | font-size: 16px; |
| 3027 | 3041 | } |
diff --git src/bp-templates/bp-nouveau/includes/messages/functions.php src/bp-templates/bp-nouveau/includes/messages/functions.php
index e70524af1..110445ce7 100644
|
|
|
function bp_nouveau_messages_localize_scripts( $params = array() ) { |
| 107 | 107 | 'unstar' => __( 'Unstarring message(s). Please wait.', 'buddypress' ), |
| 108 | 108 | ), |
| 109 | 109 | 'bulk_actions' => bp_nouveau_messages_get_bulk_actions(), |
| | 110 | 'howto' => __( 'Click on the message title to preview it in the Active conversation box below.', 'buddypress' ), |
| | 111 | 'howtoBulk' => __( 'Use the select box to define your bulk action and click on the ✓ button to apply.', 'buddypress' ), |
| | 112 | 'toOthers' => array( |
| | 113 | 'one' => __( '(and 1 other)', 'buddypress' ), |
| | 114 | 'more' => __( '(and %d others)', 'buddypress' ), |
| | 115 | ), |
| 110 | 116 | ); |
| 111 | 117 | |
| 112 | 118 | // Star private messages. |
diff --git src/bp-templates/bp-nouveau/js/buddypress-messages.js src/bp-templates/bp-nouveau/js/buddypress-messages.js
index 378684c8a..0a0331218 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 .subject' : 'changePreview', |
| 639 | 638 | }, |
| 640 | 639 | |
| 641 | 640 | initialize: function() { |
| … |
… |
window.bp = window.bp || {}; |
| 666 | 665 | |
| 667 | 666 | threadsFetched: function() { |
| 668 | 667 | bp.Nouveau.Messages.removeFeedback(); |
| | 668 | |
| | 669 | // Inform the user about how to use the UI. |
| | 670 | bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howto, 'info' ); |
| 669 | 671 | }, |
| 670 | 672 | |
| 671 | 673 | threadsFetchError: function( collection, response ) { |
| … |
… |
window.bp = window.bp || {}; |
| 688 | 690 | this.views.add( '#message-threads', new bp.Views.userThread( { model: thread } ) ); |
| 689 | 691 | }, |
| 690 | 692 | |
| 691 | | changePreview: function( event ) { |
| 692 | | var target = $( event.currentTarget ); |
| 693 | | |
| 694 | | if ( ! target.hasClass( 'thread-content' ) || $( event.target ).hasClass( 'user-link' ) ) { |
| 695 | | return event; |
| 696 | | } |
| 697 | | |
| 698 | | event.preventDefault(); |
| 699 | | |
| 700 | | if ( target.parent( 'li' ).hasClass( 'selected' ) ) { |
| | 693 | setActiveThread: function( active ) { |
| | 694 | if ( ! active ) { |
| 701 | 695 | return; |
| 702 | 696 | } |
| 703 | 697 | |
| 704 | | var selected = target.data( 'thread-id' ); |
| 705 | | |
| 706 | 698 | _.each( this.collection.models, function( thread ) { |
| 707 | | if ( thread.id === selected ) { |
| | 699 | if ( thread.id === active ) { |
| 708 | 700 | thread.set( 'active', true ); |
| 709 | 701 | } else { |
| 710 | 702 | thread.unset( 'active' ); |
| … |
… |
window.bp = window.bp || {}; |
| 712 | 704 | }, this ); |
| 713 | 705 | }, |
| 714 | 706 | |
| 715 | | loadSingleView: function( event ) { |
| | 707 | changePreview: function( event ) { |
| 716 | 708 | var target = $( event.currentTarget ); |
| 717 | 709 | |
| 718 | | if ( ! target.hasClass( 'thread-content' ) || $( event.target ).hasClass( 'user-link' ) ) { |
| 719 | | return event; |
| | 710 | event.preventDefault(); |
| | 711 | bp.Nouveau.Messages.removeFeedback(); |
| | 712 | |
| | 713 | // If the click is done on an active conversation, open it. |
| | 714 | if ( $( event.currentTarget ).closest( '.thread-item' ).hasClass( 'selected' ) ) { |
| | 715 | this.loadSingleView( event ); |
| | 716 | |
| | 717 | // Otherwise activate the conversation and display its preview. |
| | 718 | } else { |
| | 719 | this.setActiveThread( target.closest( '.thread-content' ).data( 'thread-id' ) ); |
| | 720 | |
| | 721 | $( '.message-action-view' ).focus(); |
| 720 | 722 | } |
| | 723 | }, |
| 721 | 724 | |
| | 725 | loadSingleView: function( event ) { |
| 722 | 726 | event.preventDefault(); |
| 723 | 727 | |
| 724 | | var id = target.data( 'thread-id' ); |
| 725 | | |
| 726 | | bp.Nouveau.Messages.router.navigate( 'view/' + id, { trigger: true } ); |
| | 728 | bp.Nouveau.Messages.router.navigate( |
| | 729 | 'view/' + $( event.currentTarget ).closest( '.thread-content' ).data( 'thread-id' ), |
| | 730 | { trigger: true } |
| | 731 | ); |
| 727 | 732 | } |
| 728 | 733 | } ); |
| 729 | 734 | |
| … |
… |
window.bp = window.bp || {}; |
| 745 | 750 | this.el.className += ' unread'; |
| 746 | 751 | } |
| 747 | 752 | |
| | 753 | if ( 'sentbox' === bp.Nouveau.Messages.box ) { |
| | 754 | var recipientsCount = this.model.get( 'recipients' ).length, toOthers = ''; |
| | 755 | |
| | 756 | if ( 2 === recipientsCount ) { |
| | 757 | toOthers = BP_Nouveau.messages.toOthers.one; |
| | 758 | } else if ( 2 < recipientsCount ) { |
| | 759 | toOthers = BP_Nouveau.messages.toOthers.more.replace( '%d', Number( recipientsCount - 1 ) ); |
| | 760 | } |
| | 761 | |
| | 762 | this.model.set( { |
| | 763 | recipientsCount: recipientsCount, |
| | 764 | toOthers: toOthers |
| | 765 | }, { silent: true } ) |
| | 766 | } else if ( this.model.get( 'recipientsCount' ) ) { |
| | 767 | this.model.unset( 'recipientsCount', { silent: true } ); |
| | 768 | } |
| | 769 | |
| 748 | 770 | this.model.on( 'change:active', this.toggleClass, this ); |
| 749 | 771 | this.model.on( 'change:unread', this.updateReadState, this ); |
| 750 | 772 | this.model.on( 'change:checked', this.bulkSelect, this ); |
| … |
… |
window.bp = window.bp || {}; |
| 789 | 811 | |
| 790 | 812 | if ( hasChecked ) { |
| 791 | 813 | $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).removeClass( 'bp-hide' ); |
| | 814 | |
| | 815 | // Inform the user about how to use the bulk actions. |
| | 816 | bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howtoBulk, 'info' ); |
| 792 | 817 | } else { |
| 793 | 818 | $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).addClass( 'bp-hide' ); |
| | 819 | |
| | 820 | bp.Nouveau.Messages.removeFeedback(); |
| 794 | 821 | } |
| 795 | 822 | }, |
| 796 | 823 | |
| … |
… |
window.bp = window.bp || {}; |
| 931 | 958 | |
| 932 | 959 | if ( isChecked ) { |
| 933 | 960 | $( this.el ).find( '.bulk-actions-wrap' ).removeClass( 'bp-hide' ).addClass( 'bp-show' ); |
| | 961 | |
| | 962 | // Inform the user about how to use the bulk actions. |
| | 963 | bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howtoBulk, 'info' ); |
| 934 | 964 | } else { |
| 935 | 965 | $( this.el ).find( '.bulk-actions-wrap' ).addClass( 'bp-hide' ); |
| | 966 | |
| | 967 | bp.Nouveau.Messages.removeFeedback(); |
| 936 | 968 | } |
| 937 | 969 | |
| 938 | 970 | _.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..7fc3a6376 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 | | cursor: pointer; |
| 138 | 150 | |
| 139 | 151 | .excerpt { |
| 140 | 152 | color: $meta-text; |
| … |
… |
|
| 144 | 156 | } |
| 145 | 157 | |
| 146 | 158 | .thread-from, |
| | 159 | .thread-to, |
| 147 | 160 | .thread-subject { |
| 148 | 161 | |
| 149 | 162 | @include responsive-font(16); |