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 8fa9753e8..a5eade58f 100644
|
|
|
13 | 13 | <div class="bp-messages-feedback"></div> |
14 | 14 | <div class="bp-messages-content"></div> |
15 | 15 | |
| 16 | <script type="text/html" id="tmpl-bp-messages-feedback"> |
| 17 | <div class="bp-feedback {{data.type}}"> |
| 18 | <span class="bp-icon" aria-hidden="true"></span> |
| 19 | <p>{{{data.message}}}</p> |
| 20 | </div> |
| 21 | </script> |
| 22 | |
16 | 23 | <script type="text/html" id="tmpl-bp-messages-form"> |
17 | 24 | <?php bp_nouveau_messages_hook( 'before', 'compose_content' ); ?> |
18 | 25 | |
diff --git src/bp-templates/bp-nouveau/includes/messages/ajax.php src/bp-templates/bp-nouveau/includes/messages/ajax.php
index c66c40ba6..1151501ee 100644
|
|
function bp_nouveau_ajax_messages_send_message() { |
107 | 107 | */ |
108 | 108 | function bp_nouveau_ajax_messages_send_reply() { |
109 | 109 | $response = array( |
110 | | 'feedback' => '<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'There was a problem sending your reply. Please try again.', 'buddypress' ) . '</p></div>', |
| 110 | 'feedback' => __( 'There was a problem sending your reply. Please try again.', 'buddypress' ), |
111 | 111 | 'type' => 'error', |
112 | 112 | ); |
113 | 113 | |
… |
… |
function bp_nouveau_ajax_messages_send_reply() { |
186 | 186 | |
187 | 187 | wp_send_json_success( array( |
188 | 188 | 'messages' => array( $reply ), |
189 | | 'feedback' => '<div class="bp-feedback success"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'Your reply was sent successfully', 'buddypress' ) . '</p></div>', |
| 189 | 'feedback' => __( 'Your reply was sent successfully', 'buddypress' ), |
190 | 190 | 'type' => 'success', |
191 | 191 | ) ); |
192 | 192 | } |
… |
… |
function bp_nouveau_ajax_get_user_message_threads() { |
199 | 199 | |
200 | 200 | if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'bp_nouveau_messages' ) ) { |
201 | 201 | wp_send_json_error( array( |
202 | | 'feedback' => '<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'Unauthorized request.', 'buddypress' ) . '</p></div>', |
| 202 | 'feedback' => __( 'Unauthorized request.', 'buddypress' ), |
203 | 203 | 'type' => 'error' |
204 | 204 | ) ); |
205 | 205 | } |
… |
… |
function bp_nouveau_ajax_get_user_message_threads() { |
214 | 214 | // Simulate the loop. |
215 | 215 | if ( ! bp_has_message_threads( bp_ajax_querystring( 'messages' ) ) ) { |
216 | 216 | wp_send_json_error( array( |
217 | | 'feedback' => '<div class="bp-feedback info"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'Sorry, no messages were found.', 'buddypress' ) . '</p></div>', |
| 217 | 'feedback' => __( 'Sorry, no messages were found.', 'buddypress' ), |
218 | 218 | 'type' => 'info' |
219 | 219 | ) ); |
220 | 220 | } |
… |
… |
function bp_nouveau_ajax_get_thread_messages() { |
341 | 341 | |
342 | 342 | if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'bp_nouveau_messages' ) ) { |
343 | 343 | wp_send_json_error( array( |
344 | | 'feedback' => '<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'Unauthorized request.', 'buddypress' ) . '</p></div>', |
| 344 | 'feedback' => __( 'Unauthorized request.', 'buddypress' ), |
345 | 345 | 'type' => 'error' |
346 | 346 | ) ); |
347 | 347 | } |
348 | 348 | |
349 | 349 | $response = array( |
350 | | 'feedback' => '<div class="bp-feedback info"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'Sorry, no messages were found.', 'buddypress' ) . '</p></div>', |
| 350 | 'feedback' => __( 'Sorry, no messages were found.', 'buddypress' ), |
351 | 351 | 'type' => 'info' |
352 | 352 | ); |
353 | 353 | |
… |
… |
function bp_nouveau_ajax_get_thread_messages() { |
434 | 434 | */ |
435 | 435 | function bp_nouveau_ajax_delete_thread_messages() { |
436 | 436 | $response = array( |
437 | | 'feedback' => '<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'There was a problem deleting your message(s). Please try again.', 'buddypress' ) . '</p></div>', |
| 437 | 'feedback' => __( 'There was a problem deleting your message(s). Please try again.', 'buddypress' ), |
438 | 438 | 'type' => 'error', |
439 | 439 | ); |
440 | 440 | |
… |
… |
function bp_nouveau_ajax_delete_thread_messages() { |
457 | 457 | } |
458 | 458 | |
459 | 459 | wp_send_json_success( array( |
460 | | 'feedback' => '<div class="bp-feedback info"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'Message(s) deleted', 'buddypress' ) . '</p></div>', |
| 460 | 'feedback' => __( 'Message(s) deleted', 'buddypress' ), |
461 | 461 | 'type' => 'success', |
462 | 462 | ) ); |
463 | 463 | } |
… |
… |
function bp_nouveau_ajax_star_thread_messages() { |
479 | 479 | } |
480 | 480 | |
481 | 481 | $response = array( |
482 | | 'feedback' => '<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>' . esc_html( $error_message ) . '</p></div>', |
| 482 | 'feedback' => esc_html( $error_message ), |
483 | 483 | 'type' => 'error', |
484 | 484 | ); |
485 | 485 | |
… |
… |
function bp_nouveau_ajax_star_thread_messages() { |
555 | 555 | } |
556 | 556 | |
557 | 557 | wp_send_json_success( array( |
558 | | 'feedback' => '<div class="bp-feedback info"><span class="bp-icon" aria-hidden="true"></span><p>' . esc_html( $success_message ) . '</p></div>', |
| 558 | 'feedback' => esc_html( $success_message ), |
559 | 559 | 'type' => 'success', |
560 | 560 | 'messages' => $messages, |
561 | 561 | ) ); |
… |
… |
function bp_nouveau_ajax_readunread_thread_messages() { |
578 | 578 | |
579 | 579 | if ( 'unread' === $action ) { |
580 | 580 | $response = array( |
581 | | 'feedback' => '<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'There was a problem marking your message(s) as unread. Please try again.', 'buddypress' ) . '</p></div>', |
| 581 | 'feedback' => __( 'There was a problem marking your message(s) as unread. Please try again.', 'buddypress' ), |
582 | 582 | 'type' => 'error', |
583 | 583 | ); |
584 | 584 | } |
… |
… |
function bp_nouveau_ajax_readunread_thread_messages() { |
596 | 596 | $response['messages'] = array(); |
597 | 597 | |
598 | 598 | if ( 'unread' === $action ) { |
599 | | $response['feedback'] = '<div class="bp-feedback info"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'Message(s) marked as unread.', 'buddypress' ) . '</p></div>'; |
| 599 | $response['feedback'] = __( 'Message(s) marked as unread.', 'buddypress' ); |
600 | 600 | } else { |
601 | | $response['feedback'] = '<div class="bp-feedback info"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'Message(s) marked as read.', 'buddypress' ) . '</p></div>'; |
| 601 | $response['feedback'] = __( 'Message(s) marked as read.', 'buddypress' ); |
602 | 602 | } |
603 | 603 | |
604 | 604 | foreach ( $thread_ids as $thread_id ) { |
diff --git src/bp-templates/bp-nouveau/includes/messages/functions.php src/bp-templates/bp-nouveau/includes/messages/functions.php
index 693e5e51e..852637084 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' => '<div class="bp-feedback info"><span class="bp-icon" aria-hidden="true"></span><p>' . __( 'Loading messages. Please wait.', 'buddypress' ) . '</p></div>', |
| 101 | 'loading' => __( 'Loading messages. Please wait.', 'buddypress' ), |
102 | 102 | 'bulk_actions' => bp_nouveau_messages_get_bulk_actions(), |
103 | 103 | ); |
104 | 104 | |
diff --git src/bp-templates/bp-nouveau/js/buddypress-messages.js src/bp-templates/bp-nouveau/js/buddypress-messages.js
index e706a69f7..efc9e989b 100644
|
|
window.bp = window.bp || {}; |
452 | 452 | bp.Views.Feedback = bp.Nouveau.Messages.View.extend( { |
453 | 453 | tagName: 'div', |
454 | 454 | className: 'bp-messages bp-user-messages-feedback', |
| 455 | template : bp.template( 'bp-messages-feedback' ), |
455 | 456 | |
456 | 457 | initialize: function() { |
457 | | this.value = this.options.value; |
458 | | |
459 | | if ( this.options.type ) { |
460 | | this.el.className += ' ' + this.options.type; |
461 | | } |
462 | | }, |
463 | | |
464 | | render: function() { |
465 | | this.$el.html( this.value ); |
466 | | return this; |
| 458 | this.model = new Backbone.Model( { |
| 459 | type: this.options.type || 'info', |
| 460 | message: this.options.value, |
| 461 | } ); |
467 | 462 | } |
468 | 463 | } ); |
469 | 464 | |