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 eb9ad5d0d..e8b40f840 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"></span><p>' . __( 'Loading messages. Please wait.', 'buddypress' ) . '</p></div>', |
| | 102 | 'howto' => '<div class="bp-feedback info"><span class="bp-icon"></span><p>' . |
| | 103 | __( 'Click on the message title to preview a message. Double click on the message title to open the full conversation.', 'buddypress' ) . |
| | 104 | __( 'Use ctrl+d or ctrl+u to toggle the message preview down or up in the list. Use ctrl+enter to open a selected conversation.', 'buddypress' ) . |
| | 105 | '</p></div>', |
| 102 | 106 | 'bulk_actions' => bp_nouveau_messages_get_bulk_actions(), |
| | 107 | 'howtoBulk' => '<div class="bp-feedback info"><span class="bp-icon"></span><p>' . __( 'Use the select box to define your bulk action and click on the ✓ button to apply.', 'buddypress' ) . '</p></div>', |
| 103 | 108 | ); |
| 104 | 109 | |
| 105 | 110 | // Star private messages. |
diff --git src/bp-templates/bp-nouveau/js/buddypress-messages.js src/bp-templates/bp-nouveau/js/buddypress-messages.js
index e706a69f7..e5dbaf2af 100644
|
|
|
window.bp = window.bp || {}; |
| 365 | 365 | } ); |
| 366 | 366 | |
| 367 | 367 | return bp.ajax.send( options ); |
| | 368 | }, |
| | 369 | |
| | 370 | /** |
| | 371 | * Get the "at" index for a model satisfying the requested attribute. |
| | 372 | * |
| | 373 | * @param {object} attribute An object containing the attribute key and value. |
| | 374 | * @return {integer} The "at" position into the collection. |
| | 375 | */ |
| | 376 | getAt: function( attribute ) { |
| | 377 | var key = _.first( _.keys( attribute ) ), |
| | 378 | at = -1; |
| | 379 | |
| | 380 | _.each( this.models, function( model, index ) { |
| | 381 | if ( attribute[ key ] === model.get( key ) ) { |
| | 382 | at = index; |
| | 383 | } |
| | 384 | } ); |
| | 385 | |
| | 386 | return at; |
| 368 | 387 | } |
| 369 | 388 | } ); |
| 370 | 389 | |
| … |
… |
window.bp = window.bp || {}; |
| 655 | 674 | |
| 656 | 675 | this.collection.on( 'reset', this.cleanContent, this ); |
| 657 | 676 | this.collection.on( 'add', this.addThread, this ); |
| | 677 | |
| | 678 | $( document ).on( 'keydown', _.bind( this.keyAction, this ) ); |
| 658 | 679 | }, |
| 659 | 680 | |
| 660 | 681 | requestThreads: function() { |
| … |
… |
window.bp = window.bp || {}; |
| 671 | 692 | |
| 672 | 693 | threadsFetched: function() { |
| 673 | 694 | bp.Nouveau.Messages.removeFeedback(); |
| | 695 | |
| | 696 | bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howto, 'info' ); |
| 674 | 697 | }, |
| 675 | 698 | |
| 676 | 699 | threadsFetchError: function( collection, response ) { |
| … |
… |
window.bp = window.bp || {}; |
| 693 | 716 | this.views.add( '#message-threads', new bp.Views.userThread( { model: thread } ) ); |
| 694 | 717 | }, |
| 695 | 718 | |
| | 719 | setActiveThread: function( active ) { |
| | 720 | if ( ! active ) { |
| | 721 | return; |
| | 722 | } |
| | 723 | |
| | 724 | _.each( this.collection.models, function( thread ) { |
| | 725 | if ( thread.id === active ) { |
| | 726 | thread.set( 'active', true ); |
| | 727 | } else { |
| | 728 | thread.unset( 'active' ); |
| | 729 | } |
| | 730 | }, this ); |
| | 731 | }, |
| | 732 | |
| 696 | 733 | changePreview: function( event ) { |
| 697 | 734 | var target = $( event.currentTarget ); |
| 698 | 735 | |
| … |
… |
window.bp = window.bp || {}; |
| 701 | 738 | } |
| 702 | 739 | |
| 703 | 740 | event.preventDefault(); |
| | 741 | bp.Nouveau.Messages.removeFeedback(); |
| 704 | 742 | |
| 705 | 743 | if ( target.parent( 'li' ).hasClass( 'selected' ) ) { |
| 706 | 744 | return; |
| 707 | 745 | } |
| 708 | 746 | |
| 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 ); |
| | 747 | this.setActiveThread( target.data( 'thread-id' ) ); |
| 718 | 748 | }, |
| 719 | 749 | |
| 720 | 750 | loadSingleView: function( event ) { |
| … |
… |
window.bp = window.bp || {}; |
| 729 | 759 | var id = target.data( 'thread-id' ); |
| 730 | 760 | |
| 731 | 761 | bp.Nouveau.Messages.router.navigate( 'view/' + id, { trigger: true } ); |
| | 762 | }, |
| | 763 | |
| | 764 | keyAction: function( event ) { |
| | 765 | if ( ! event.ctrlKey ) { |
| | 766 | return; |
| | 767 | } |
| | 768 | |
| | 769 | // Catch enter/arrow events |
| | 770 | if ( 13 !== event.keyCode && 68 !== event.keyCode && 85 !== event.keyCode ) { |
| | 771 | return; |
| | 772 | } |
| | 773 | |
| | 774 | var model; |
| | 775 | bp.Nouveau.Messages.removeFeedback(); |
| | 776 | |
| | 777 | if ( 13 === event.keyCode ) { |
| | 778 | model = _.find( this.collection.models, function( model ) { |
| | 779 | return true === model.get( 'active' ); |
| | 780 | } ); |
| | 781 | |
| | 782 | if ( ! model.get( 'id' ) ) { |
| | 783 | return; |
| | 784 | } |
| | 785 | |
| | 786 | bp.Nouveau.Messages.router.navigate( 'view/' + model.get( 'id' ), { trigger: true } ); |
| | 787 | } else { |
| | 788 | var active = this.collection.getAt( { active: true } ), unactivate = active; |
| | 789 | |
| | 790 | if ( 85 === event.keyCode ) { |
| | 791 | active -= 1; |
| | 792 | } else { |
| | 793 | active +=1; |
| | 794 | } |
| | 795 | |
| | 796 | if ( active >= 0 && active < this.collection.length && unactivate !== active ) { |
| | 797 | model = this.collection.at( active ); |
| | 798 | this.setActiveThread( model.get( 'id' ) ); |
| | 799 | } |
| | 800 | } |
| 732 | 801 | } |
| 733 | 802 | } ); |
| 734 | 803 | |
| … |
… |
window.bp = window.bp || {}; |
| 794 | 863 | |
| 795 | 864 | if ( hasChecked ) { |
| 796 | 865 | $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).removeClass( 'bp-hide' ); |
| | 866 | |
| | 867 | bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howtoBulk, 'info' ); |
| 797 | 868 | } else { |
| 798 | 869 | $( '#user-messages-bulk-actions' ).closest( '.bulk-actions-wrap' ).addClass( 'bp-hide' ); |
| | 870 | |
| | 871 | bp.Nouveau.Messages.removeFeedback(); |
| 799 | 872 | } |
| 800 | 873 | }, |
| 801 | 874 | |
| … |
… |
window.bp = window.bp || {}; |
| 925 | 998 | |
| 926 | 999 | if ( isChecked ) { |
| 927 | 1000 | $( this.el ).find( '.bulk-actions-wrap' ).removeClass( 'bp-hide' ).addClass( 'bp-show' ); |
| | 1001 | |
| | 1002 | bp.Nouveau.Messages.displayFeedback( BP_Nouveau.messages.howtoBulk, 'info' ); |
| 928 | 1003 | } else { |
| 929 | 1004 | $( this.el ).find( '.bulk-actions-wrap' ).addClass( 'bp-hide' ); |
| | 1005 | |
| | 1006 | bp.Nouveau.Messages.removeFeedback(); |
| 930 | 1007 | } |
| 931 | 1008 | |
| 932 | 1009 | _.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 | |