[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-templates/bp-nouveau/js/ -> buddypress-member-invites.js (source)

   1  /**
   2   * Handles the dynamic parts of the Member's Pending Invitations screen.
   3   *
   4   * @since  8.0.0
   5   * @version 8.0.0
   6   */
   7  ( function() {
   8      /**
   9       * Organizes the dynamic parts of the Member's Pending Invitations screen.
  10       *
  11       * @namespace bp.Nouveau.Invitations
  12       * @memberof  bp.Nouveau
  13       *
  14       * @since  8.0.0
  15       * @type {Object}
  16       */
  17      var Invitations = {
  18          /**
  19           * Selects/Unselects all invitations.
  20           *
  21           * @since 8.0.0
  22           *
  23           * @param {Object} event The click event.
  24           */
  25          toggleSelection: function( event ) {
  26              document.querySelectorAll( '.invitation-check' ).forEach( function( cb ) {
  27                  cb.checked = event.target.checked;
  28              } );
  29          },
  30          /**
  31           * Selects/Unselects all invitations.
  32           *
  33           * @since 8.0.0
  34           *
  35           * @param {Object} event The click event.
  36           */
  37          toggleSubmit: function( event ) {
  38              if ( ! event.target.value ) {
  39                  document.querySelector( '#invitation-bulk-manage' ).setAttribute( 'disabled', 'disabled' );
  40              } else {
  41                  document.querySelector( '#invitation-bulk-manage' ).removeAttribute( 'disabled' );
  42              }
  43          },
  44          /**
  45           * Adds listeners.
  46           *
  47           * @since 8.0.0
  48           */
  49          start: function() {
  50              // Disable the submit button.
  51              document.querySelector( '#invitation-bulk-manage' ).setAttribute( 'disabled', 'disabled' );
  52  
  53              // Select/UnSelect all invitations.
  54              document.querySelector( '#select-all-invitations' ).addEventListener( 'click', this.toggleSelection );
  55  
  56              // Enable/Disable the submit button.
  57              document.querySelector( '#invitation-select' ).addEventListener( 'change', this.toggleSubmit );
  58          }
  59      };
  60  
  61      window.bp = window.bp || {};
  62      if ( window.bp.Nouveau ) {
  63          window.bp.Nouveau.Invitations = Invitations;
  64  
  65          Invitations.start();
  66      }
  67  } )();


Generated: Sun Dec 22 01:00:54 2024 Cross-referenced by PHPXref 0.7.1