Changeset 12358
- Timestamp:
- 03/14/2019 05:37:11 AM (6 years ago)
- Location:
- trunk/src/bp-templates/bp-nouveau
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-templates/bp-nouveau/buddypress/common/js-templates/activity/form.php
r12156 r12358 3 3 * Activity Post form JS Templates 4 4 * 5 * @version 3.1.0 5 * @since 3.0.0 6 * @version 5.0.0 6 7 */ 7 8 ?> 9 10 <script type="text/html" id="tmpl-activity-before-post-form-inputs"> 11 <?php bp_nouveau_activity_hook( 'before', 'post_form' ); ?> 12 </script> 8 13 9 14 <script type="text/html" id="tmpl-activity-post-form-feedback"> -
trunk/src/bp-templates/bp-nouveau/includes/activity/functions.php
r12283 r12358 4 4 * 5 5 * @since 3.0.0 6 * @version 3.1.06 * @version 5.0.0 7 7 */ 8 8 … … 68 68 'user_id' => bp_loggedin_user_id(), 69 69 'object' => 'user', 70 'backcompat' => (bool) has_action( 'bp_activity_post_form_options' ), 70 'backcompat' => array( 71 'before_post_form' => (bool) has_action( 'bp_before_activity_post_form' ), 72 'post_form_options' => (bool) has_action( 'bp_activity_post_form_options' ), 73 ), 71 74 'post_nonce' => wp_create_nonce( 'post_update', '_wpnonce_post_update' ), 72 75 ); -
trunk/src/bp-templates/bp-nouveau/includes/activity/template-tags.php
r12348 r12358 4 4 * 5 5 * @since 3.0.0 6 * @version 3.1.06 * @version 5.0.0 7 7 */ 8 8 … … 68 68 * 69 69 * @since 3.0.0 70 * @since 5.0.0 Move the `bp_before_activity_post_form` hook inside the Activity post form. 70 71 */ 71 72 function bp_nouveau_before_activity_post_form() { … … 73 74 wp_enqueue_script( 'bp-nouveau-activity-post-form' ); 74 75 } 75 76 /**77 * Fires before the activity post form.78 *79 * @since 1.2.080 */81 do_action( 'bp_before_activity_post_form' );82 76 } 83 77 -
trunk/src/bp-templates/bp-nouveau/js/buddypress-activity-post-form.js
r12156 r12358 1 1 /* global bp, BP_Nouveau, _, Backbone */ 2 /* @version 3.1.0 */ 2 /* @since 3.0.0 */ 3 /* @version 5.0.0 */ 3 4 window.wp = window.wp || {}; 4 5 window.bp = window.bp || {}; … … 376 377 } ); 377 378 379 bp.Views.BeforeFormInputs = bp.View.extend( { 380 tagName : 'div', 381 template : bp.template( 'activity-before-post-form-inputs' ) 382 } ); 383 378 384 bp.Views.FormTarget = bp.View.extend( { 379 385 tagName : 'div', … … 587 593 ['user_id', 'item_id', 'object' ] 588 594 ) ); 595 this.options.backcompat = BP_Nouveau.activity.params.backcompat; 596 var staticViews = [ 597 new bp.Views.FormAvatar(), 598 new bp.Views.FormContent( { activity: this.model } ) 599 ]; 600 601 // Backcompat to take the `bp_before_activity_post_form` action in account. 602 if ( true === this.options.backcompat.before_post_form ) { 603 staticViews.unshift( new bp.Views.BeforeFormInputs() ); 604 } 589 605 590 606 // Clone the model to set the resetted one 591 607 this.resetModel = this.model.clone(); 592 608 593 this.views.set( [ 594 new bp.Views.FormAvatar(), 595 new bp.Views.FormContent( { activity: this.model } ) 596 ] ); 609 this.views.set( staticViews ); 597 610 598 611 this.model.on( 'change:errors', this.displayFeedback, this ); … … 600 613 601 614 displayFull: function( event ) { 615 var numStaticViews = true === this.options.backcompat.before_post_form ? 3 : 2; 602 616 603 617 // Remove feedback. 604 618 this.cleanFeedback(); 605 619 606 if ( 2!== this.views._views[''].length ) {620 if ( numStaticViews !== this.views._views[''].length ) { 607 621 return; 608 622 } … … 613 627 } ); 614 628 615 // Backcompat custom fields616 if ( true === BP_Nouveau.activity.params.backcompat) {629 // Add the container view for buttons or custom fields. 630 if ( true === this.options.backcompat.post_form_options ) { 617 631 this.views.add( new bp.Views.FormOptions( { model: this.model } ) ); 632 } else { 633 this.views.add( new bp.View( { id: 'whats-new-options' } ) ); 618 634 } 619 635 … … 622 638 // Global 623 639 bp.Nouveau.Activity.postForm.buttons.set( BP_Nouveau.activity.params.buttons ); 624 this.views.add( new bp.Views.FormButtons( { collection: bp.Nouveau.Activity.postForm.buttons, model: this.model } ) );640 this.views.add( '#whats-new-options', new bp.Views.FormButtons( { collection: bp.Nouveau.Activity.postForm.buttons, model: this.model } ) ); 625 641 } 626 642 627 643 // Select box for the object 628 644 if ( ! _.isUndefined( BP_Nouveau.activity.params.objects ) && 1 < _.keys( BP_Nouveau.activity.params.objects ).length ) { 629 this.views.add( new bp.Views.FormTarget( { model: this.model } ) );630 } 631 632 this.views.add( new bp.Views.FormSubmit( { model: this.model } ) );645 this.views.add( '#whats-new-options', new bp.Views.FormTarget( { model: this.model } ) ); 646 } 647 648 this.views.add( '#whats-new-options', new bp.Views.FormSubmit( { model: this.model } ) ); 633 649 }, 634 650 635 651 resetForm: function() { 652 var self = this, indexStaticViews = self.options.backcompat.before_post_form ? 2 : 1; 653 636 654 _.each( this.views._views[''], function( view, index ) { 637 if ( index > 1) {655 if ( index > indexStaticViews ) { 638 656 view.remove(); 639 657 }
Note: See TracChangeset
for help on using the changeset viewer.