[ 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  var _wp = wp,
 132      __ = _wp.i18n.__;
 133  /**
 134   * Avatar sizes.
 135   *
 136   * @type {Array}
 137   */
 138  
 139  var AVATAR_SIZES = [{
 140    label: __('None', 'buddypress'),
 141    value: 'none'
 142  }, {
 143    label: __('Thumb', 'buddypress'),
 144    value: 'thumb'
 145  }, {
 146    label: __('Full', 'buddypress'),
 147    value: 'full'
 148  }];
 149  /**
 150   * Group stati.
 151   *
 152   * @type {Object}
 153   */
 154  
 155  exports.AVATAR_SIZES = AVATAR_SIZES;
 156  var GROUP_STATI = {
 157    public: __('Public', 'buddypress'),
 158    private: __('Private', 'buddypress'),
 159    hidden: __('Hidden', 'buddypress')
 160  };
 161  exports.GROUP_STATI = GROUP_STATI;
 162  },{}],"cCC3":[function(require,module,exports) {
 163  "use strict";
 164  
 165  Object.defineProperty(exports, "__esModule", {
 166    value: true
 167  });
 168  exports.default = void 0;
 169  
 170  var _constants = require("./constants");
 171  
 172  /**
 173   * WordPress dependencies.
 174   */
 175  var _wp = wp,
 176      _wp$blockEditor = _wp.blockEditor,
 177      InspectorControls = _wp$blockEditor.InspectorControls,
 178      BlockControls = _wp$blockEditor.BlockControls,
 179      _wp$components = _wp.components,
 180      Placeholder = _wp$components.Placeholder,
 181      Disabled = _wp$components.Disabled,
 182      PanelBody = _wp$components.PanelBody,
 183      SelectControl = _wp$components.SelectControl,
 184      ToggleControl = _wp$components.ToggleControl,
 185      Toolbar = _wp$components.Toolbar,
 186      ToolbarButton = _wp$components.ToolbarButton,
 187      _wp$element = _wp.element,
 188      Fragment = _wp$element.Fragment,
 189      createElement = _wp$element.createElement,
 190      __ = _wp.i18n.__;
 191  /**
 192   * BuddyPress dependencies.
 193   */
 194  
 195  var _bp = bp,
 196      _bp$blockComponents = _bp.blockComponents,
 197      AutoCompleter = _bp$blockComponents.AutoCompleter,
 198      ServerSideRender = _bp$blockComponents.ServerSideRender,
 199      isActive = _bp.blockData.isActive;
 200  /**
 201   * Internal dependencies.
 202   */
 203  
 204  var getSlugValue = function getSlugValue(item) {
 205    if (item && item.status && _constants.GROUP_STATI[item.status]) {
 206      return _constants.GROUP_STATI[item.status];
 207    }
 208  
 209    return null;
 210  };
 211  
 212  var editGroupBlock = function editGroupBlock(_ref) {
 213    var attributes = _ref.attributes,
 214        setAttributes = _ref.setAttributes;
 215    var isAvatarEnabled = isActive('groups', 'avatar');
 216    var isCoverImageEnabled = isActive('groups', 'cover');
 217    var avatarSize = attributes.avatarSize,
 218        displayDescription = attributes.displayDescription,
 219        displayActionButton = attributes.displayActionButton,
 220        displayCoverImage = attributes.displayCoverImage;
 221  
 222    if (!attributes.itemID) {
 223      return createElement(Placeholder, {
 224        icon: "buddicons-groups",
 225        label: __('BuddyPress Group', 'buddypress'),
 226        instructions: __('Start typing the name of the group you want to feature into this post.', 'buddypress')
 227      }, createElement(AutoCompleter, {
 228        component: "groups",
 229        objectQueryArgs: {
 230          'show_hidden': false
 231        },
 232        slugValue: getSlugValue,
 233        ariaLabel: __('Group\'s name', 'buddypress'),
 234        placeholder: __('Enter Group\'s name hereā€¦', 'buddypress'),
 235        onSelectItem: setAttributes,
 236        useAvatar: isAvatarEnabled
 237      }));
 238    }
 239  
 240    return createElement(Fragment, null, createElement(BlockControls, null, createElement(Toolbar, {
 241      label: __('Block toolbar', 'buddypress')
 242    }, createElement(ToolbarButton, {
 243      icon: "edit",
 244      title: __('Select another group', 'buddypress'),
 245      onClick: function onClick() {
 246        setAttributes({
 247          itemID: 0
 248        });
 249      }
 250    }))), createElement(InspectorControls, null, createElement(PanelBody, {
 251      title: __('Settings', 'buddypress'),
 252      initialOpen: true
 253    }, createElement(ToggleControl, {
 254      label: __('Display Group\'s home button', 'buddypress'),
 255      checked: !!displayActionButton,
 256      onChange: function onChange() {
 257        setAttributes({
 258          displayActionButton: !displayActionButton
 259        });
 260      },
 261      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')
 262    }), createElement(ToggleControl, {
 263      label: __('Display group\'s description', 'buddypress'),
 264      checked: !!displayDescription,
 265      onChange: function onChange() {
 266        setAttributes({
 267          displayDescription: !displayDescription
 268        });
 269      },
 270      help: displayDescription ? __('Include the group\'s description under their name.', 'buddypress') : __('Toggle to display the group\'s description under their name.', 'buddypress')
 271    }), isAvatarEnabled && createElement(SelectControl, {
 272      label: __('Avatar size', 'buddypress'),
 273      value: avatarSize,
 274      options: _constants.AVATAR_SIZES,
 275      help: __('Select "None" to disable the avatar.', 'buddypress'),
 276      onChange: function onChange(option) {
 277        setAttributes({
 278          avatarSize: option
 279        });
 280      }
 281    }), isCoverImageEnabled && createElement(ToggleControl, {
 282      label: __('Display Cover Image', 'buddypress'),
 283      checked: !!displayCoverImage,
 284      onChange: function onChange() {
 285        setAttributes({
 286          displayCoverImage: !displayCoverImage
 287        });
 288      },
 289      help: displayCoverImage ? __('Include the group\'s cover image over their name.', 'buddypress') : __('Toggle to display the group\'s cover image over their name.', 'buddypress')
 290    }))), createElement(Disabled, null, createElement(ServerSideRender, {
 291      block: "bp/group",
 292      attributes: attributes
 293    })));
 294  };
 295  
 296  var _default = editGroupBlock;
 297  exports.default = _default;
 298  },{"./constants":"atl5"}],"pvse":[function(require,module,exports) {
 299  "use strict";
 300  
 301  var _edit = _interopRequireDefault(require("./group/edit"));
 302  
 303  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 304  
 305  /**
 306   * WordPress dependencies.
 307   */
 308  var _wp = wp,
 309      registerBlockType = _wp.blocks.registerBlockType,
 310      __ = _wp.i18n.__;
 311  /**
 312   * Internal dependencies.
 313   */
 314  
 315  registerBlockType('bp/group', {
 316    title: __('Group', 'buddypress'),
 317    description: __('BuddyPress Group.', 'buddypress'),
 318    icon: {
 319      background: '#fff',
 320      foreground: '#d84800',
 321      src: 'buddicons-groups'
 322    },
 323    category: 'buddypress',
 324    attributes: {
 325      itemID: {
 326        type: 'integer',
 327        default: 0
 328      },
 329      avatarSize: {
 330        type: 'string',
 331        default: 'full'
 332      },
 333      displayDescription: {
 334        type: 'boolean',
 335        default: true
 336      },
 337      displayActionButton: {
 338        type: 'boolean',
 339        default: true
 340      },
 341      displayCoverImage: {
 342        type: 'boolean',
 343        default: true
 344      }
 345    },
 346    edit: _edit.default
 347  });
 348  },{"./group/edit":"cCC3"}]},{},["pvse"], null)


Generated: Sun Sep 19 01:01:40 2021 Cross-referenced by PHPXref 0.7.1