[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-groups/js/blocks/ -> group.js (source)

   1  // modules are defined as an array
   2  // [ module function, map of requires ]
   3  //
   4  // map of requires is short require name -> numeric require
   5  //
   6  // anything defined in a previous bundle is accessed via the
   7  // orig method which is the require for previous bundles
   8  parcelRequire = (function (modules, cache, entry, globalName) {
   9    // Save the require from previous bundle to this closure if any
  10    var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
  11    var nodeRequire = typeof require === 'function' && require;
  12  
  13    function newRequire(name, jumped) {
  14      if (!cache[name]) {
  15        if (!modules[name]) {
  16          // if we cannot find the module within our internal map or
  17          // cache jump to the current global require ie. the last bundle
  18          // that was added to the page.
  19          var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
  20          if (!jumped && currentRequire) {
  21            return currentRequire(name, true);
  22          }
  23  
  24          // If there are other bundles on this page the require from the
  25          // previous one is saved to 'previousRequire'. Repeat this as
  26          // many times as there are bundles until the module is found or
  27          // we exhaust the require chain.
  28          if (previousRequire) {
  29            return previousRequire(name, true);
  30          }
  31  
  32          // Try the node require function if it exists.
  33          if (nodeRequire && typeof name === 'string') {
  34            return nodeRequire(name);
  35          }
  36  
  37          var err = new Error('Cannot find module \'' + name + '\'');
  38          err.code = 'MODULE_NOT_FOUND';
  39          throw err;
  40        }
  41  
  42        localRequire.resolve = resolve;
  43        localRequire.cache = {};
  44  
  45        var module = cache[name] = new newRequire.Module(name);
  46  
  47        modules[name][0].call(module.exports, localRequire, module, module.exports, this);
  48      }
  49  
  50      return cache[name].exports;
  51  
  52      function localRequire(x){
  53        return newRequire(localRequire.resolve(x));
  54      }
  55  
  56      function resolve(x){
  57        return modules[name][1][x] || x;
  58      }
  59    }
  60  
  61    function Module(moduleName) {
  62      this.id = moduleName;
  63      this.bundle = newRequire;
  64      this.exports = {};
  65    }
  66  
  67    newRequire.isParcelRequire = true;
  68    newRequire.Module = Module;
  69    newRequire.modules = modules;
  70    newRequire.cache = cache;
  71    newRequire.parent = previousRequire;
  72    newRequire.register = function (id, exports) {
  73      modules[id] = [function (require, module) {
  74        module.exports = exports;
  75      }, {}];
  76    };
  77  
  78    var error;
  79    for (var i = 0; i < entry.length; i++) {
  80      try {
  81        newRequire(entry[i]);
  82      } catch (e) {
  83        // Save first error but execute all entries
  84        if (!error) {
  85          error = e;
  86        }
  87      }
  88    }
  89  
  90    if (entry.length) {
  91      // Expose entry point to Node, AMD or browser globals
  92      // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
  93      var mainExports = newRequire(entry[entry.length - 1]);
  94  
  95      // CommonJS
  96      if (typeof exports === "object" && typeof module !== "undefined") {
  97        module.exports = mainExports;
  98  
  99      // RequireJS
 100      } else if (typeof define === "function" && define.amd) {
 101       define(function () {
 102         return mainExports;
 103       });
 104  
 105      // <script>
 106      } else if (globalName) {
 107        this[globalName] = mainExports;
 108      }
 109    }
 110  
 111    // Override the current require with this new one
 112    parcelRequire = newRequire;
 113  
 114    if (error) {
 115      // throw error from earlier, _after updating parcelRequire_
 116      throw error;
 117    }
 118  
 119    return newRequire;
 120  })({"atl5":[function(require,module,exports) {
 121  "use strict";
 122  
 123  Object.defineProperty(exports, "__esModule", {
 124    value: true
 125  });
 126  exports.GROUP_STATI = exports.AVATAR_SIZES = void 0;
 127  
 128  /**
 129   * WordPress dependencies.
 130   */
 131  const {
 132    i18n: {
 133      __
 134    }
 135  } = wp;
 136  /**
 137   * Avatar sizes.
 138   *
 139   * @type {Array}
 140   */
 141  
 142  const AVATAR_SIZES = [{
 143    label: __('None', 'buddypress'),
 144    value: 'none'
 145  }, {
 146    label: __('Thumb', 'buddypress'),
 147    value: 'thumb'
 148  }, {
 149    label: __('Full', 'buddypress'),
 150    value: 'full'
 151  }];
 152  /**
 153   * Group stati.
 154   *
 155   * @type {Object}
 156   */
 157  
 158  exports.AVATAR_SIZES = AVATAR_SIZES;
 159  const GROUP_STATI = {
 160    public: __('Public', 'buddypress'),
 161    private: __('Private', 'buddypress'),
 162    hidden: __('Hidden', 'buddypress')
 163  };
 164  exports.GROUP_STATI = GROUP_STATI;
 165  },{}],"cCC3":[function(require,module,exports) {
 166  "use strict";
 167  
 168  Object.defineProperty(exports, "__esModule", {
 169    value: true
 170  });
 171  exports.default = void 0;
 172  
 173  var _constants = require("./constants");
 174  
 175  /**
 176   * WordPress dependencies.
 177   */
 178  const {
 179    blockEditor: {
 180      InspectorControls,
 181      BlockControls
 182    },
 183    components: {
 184      Placeholder,
 185      Disabled,
 186      PanelBody,
 187      SelectControl,
 188      ToggleControl,
 189      Toolbar,
 190      ToolbarButton
 191    },
 192    element: {
 193      Fragment,
 194      createElement
 195    },
 196    i18n: {
 197      __
 198    },
 199    serverSideRender: ServerSideRender
 200  } = wp;
 201  /**
 202   * BuddyPress dependencies.
 203   */
 204  
 205  const {
 206    blockComponents: {
 207      AutoCompleter
 208    },
 209    blockData: {
 210      isActive
 211    }
 212  } = bp;
 213  /**
 214   * Internal dependencies.
 215   */
 216  
 217  const getSlugValue = item => {
 218    if (item && item.status && _constants.GROUP_STATI[item.status]) {
 219      return _constants.GROUP_STATI[item.status];
 220    }
 221  
 222    return null;
 223  };
 224  
 225  const editGroupBlock = ({
 226    attributes,
 227    setAttributes
 228  }) => {
 229    const isAvatarEnabled = isActive('groups', 'avatar');
 230    const isCoverImageEnabled = isActive('groups', 'cover');
 231    const {
 232      avatarSize,
 233      displayDescription,
 234      displayActionButton,
 235      displayCoverImage
 236    } = attributes;
 237  
 238    if (!attributes.itemID) {
 239      return createElement(Placeholder, {
 240        icon: "buddicons-groups",
 241        label: __('BuddyPress Group', 'buddypress'),
 242        instructions: __('Start typing the name of the group you want to feature into this post.', 'buddypress')
 243      }, createElement(AutoCompleter, {
 244        component: "groups",
 245        objectQueryArgs: {
 246          'show_hidden': false
 247        },
 248        slugValue: getSlugValue,
 249        ariaLabel: __('Group\'s name', 'buddypress'),
 250        placeholder: __('Enter Group\'s name hereā€¦', 'buddypress'),
 251        onSelectItem: setAttributes,
 252        useAvatar: isAvatarEnabled
 253      }));
 254    }
 255  
 256    return createElement(Fragment, null, createElement(BlockControls, null, createElement(Toolbar, {
 257      label: __('Block toolbar', 'buddypress')
 258    }, createElement(ToolbarButton, {
 259      icon: "edit",
 260      title: __('Select another group', 'buddypress'),
 261      onClick: () => {
 262        setAttributes({
 263          itemID: 0
 264        });
 265      }
 266    }))), createElement(InspectorControls, null, createElement(PanelBody, {
 267      title: __('Settings', 'buddypress'),
 268      initialOpen: true
 269    }, createElement(ToggleControl, {
 270      label: __('Display Group\'s home button', 'buddypress'),
 271      checked: !!displayActionButton,
 272      onChange: () => {
 273        setAttributes({
 274          displayActionButton: !displayActionButton
 275        });
 276      },
 277      help: displayActionButton ? __('Include a link to the group\'s home page under their name.', 'buddypress') : __('Toggle to display a link to the group\'s home page under their name.', 'buddypress')
 278    }), createElement(ToggleControl, {
 279      label: __('Display group\'s description', 'buddypress'),
 280      checked: !!displayDescription,
 281      onChange: () => {
 282        setAttributes({
 283          displayDescription: !displayDescription
 284        });
 285      },
 286      help: displayDescription ? __('Include the group\'s description under their name.', 'buddypress') : __('Toggle to display the group\'s description under their name.', 'buddypress')
 287    }), isAvatarEnabled && createElement(SelectControl, {
 288      label: __('Avatar size', 'buddypress'),
 289      value: avatarSize,
 290      options: _constants.AVATAR_SIZES,
 291      help: __('Select "None" to disable the avatar.', 'buddypress'),
 292      onChange: option => {
 293        setAttributes({
 294          avatarSize: option
 295        });
 296      }
 297    }), isCoverImageEnabled && createElement(ToggleControl, {
 298      label: __('Display Cover Image', 'buddypress'),
 299      checked: !!displayCoverImage,
 300      onChange: () => {
 301        setAttributes({
 302          displayCoverImage: !displayCoverImage
 303        });
 304      },
 305      help: displayCoverImage ? __('Include the group\'s cover image over their name.', 'buddypress') : __('Toggle to display the group\'s cover image over their name.', 'buddypress')
 306    }))), createElement(Disabled, null, createElement(ServerSideRender, {
 307      block: "bp/group",
 308      attributes: attributes
 309    })));
 310  };
 311  
 312  var _default = editGroupBlock;
 313  exports.default = _default;
 314  },{"./constants":"atl5"}],"pvse":[function(require,module,exports) {
 315  "use strict";
 316  
 317  var _edit = _interopRequireDefault(require("./group/edit"));
 318  
 319  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 320  
 321  /**
 322   * WordPress dependencies.
 323   */
 324  const {
 325    blocks: {
 326      registerBlockType
 327    },
 328    i18n: {
 329      __
 330    }
 331  } = wp;
 332  /**
 333   * Internal dependencies.
 334   */
 335  
 336  registerBlockType('bp/group', {
 337    title: __('Group', 'buddypress'),
 338    description: __('BuddyPress Group.', 'buddypress'),
 339    icon: {
 340      background: '#fff',
 341      foreground: '#d84800',
 342      src: 'buddicons-groups'
 343    },
 344    category: 'buddypress',
 345    attributes: {
 346      itemID: {
 347        type: 'integer',
 348        default: 0
 349      },
 350      avatarSize: {
 351        type: 'string',
 352        default: 'full'
 353      },
 354      displayDescription: {
 355        type: 'boolean',
 356        default: true
 357      },
 358      displayActionButton: {
 359        type: 'boolean',
 360        default: true
 361      },
 362      displayCoverImage: {
 363        type: 'boolean',
 364        default: true
 365      }
 366    },
 367    edit: _edit.default
 368  });
 369  },{"./group/edit":"cCC3"}]},{},["pvse"], null)


Generated: Sat Jun 3 01:01:23 2023 Cross-referenced by PHPXref 0.7.1