How to use the babel/utils/helper/Helper.attachmentUtils function in babel

To help you get started, we’ve selected a few babel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Esri / storymap-crowdsource / src / app / components / selectedShares / SelectedDisplay.babel.js View on Github external
switch (media.type) {
      case 'video':
        // add video
        break;
      default:
        let photoUrl;

        if (fieldProps.isAttachment) {
          const attachmentUrl = Helper.attachmentUtils.getAttachmentUrlsByStringMatch({
            layer: this.props.layer,
            feature: this.props.feature,
            match: media.field,
            position: 0
          })[0] || '';

          photoUrl = Helper.attachmentUtils.checkForCredential({
            url: attachmentUrl,
            layer: this.props.layer
          });
        } else {
          photoUrl = Helper.attachmentUtils.checkForCredential({
            url: this.props.thumbnailUrlPrepend + attributes[media.field] + this.props.thumbnailUrlAppend,
            layer: this.props.layer
          });
        }

        return (
          <div>
            </div>
github Esri / storymap-crowdsource / src / app / components / intro / IntroSplash.babel.js View on Github external
<button>
          <p>{this.props.exploreText}</p>
          <div></div>
        </button>
       : null;

    let background;

    switch (this.props.background.type) {
      case 'photo':
        const backgroundUrl = Helper.attachmentUtils.checkForCredential({
          url: this.props.background.source,
          portal: this.props.portal
        });

        background = ;
        break;
    }

    return (
      <div>
        {builderText &amp;&amp; !this.props.editingAllowed ? (
          // TODO check builder mode instead of if builder text
          <button></button></div>
github Esri / storymap-crowdsource / src / app / controllers / builder / appItemAttachments / AppItemAttachments.babel.js View on Github external
uploadAttachment(data) {
    const portal = lang.getObject('appState.app.portal',false,this);
    let filename;
    let attachment;

    switch (data.type) {
      case 'photo':
        filename = data.id + data.attachment.ext;
        attachment = Helper.attachmentUtils.dataURItoBlob(data.attachment.source);
        break;
    }

    portal.uploadAppItemAttachments({
      attachment,
      filename
    }).then((url) => {
      if (data.removeAttachments) {
        portal.removeAttachments({
          keep: filename,
          filter: data.removeFilter
        });
      }
      if (typeof data.callback === 'function') {
        data.callback(url);
      }
github Esri / storymap-crowdsource / src / app / controllers / contribute / ContrbuteController.babel.js View on Github external
Object.keys(graphic.attributes).forEach((key) => {
        const value = graphic.attributes[key];

        if (typeof value === 'object' && value.attachment && value.type) {
          switch (value.type) {
            case 'photo':
              attachments.push({
                field: key,
                filename: key + value.ext,
                attachment: Helper.attachmentUtils.dataURItoBlob(value.source),
                url: false
              });
              delete graphic.attributes[key];
              break;
            default:

          }
        } else if (typeof value === 'object') {
          graphic.attributes[key] = JSON.stringify(value);
        } else if (typeof value === 'string') {
          graphic.attributes[key] = value.sanitizeHtml();
        }
      });
github Esri / storymap-crowdsource / src / app / stores / CrowdsourceAppStore.babel.js View on Github external
$.each(g.attributes, (key,value) => {
      if (typeof value === 'object' && value.attachment && value.type) {
        switch (value.type) {
          case 'photo':
            g.attributes[key] = 'ATTACHMENT_' + key;
            attachments.push({
              field: key,
              filename: key + value.ext,
              attachment: Helper.attachmentUtils.dataURItoBlob(value.source)
            });
            break;
        }
      } else if (typeof value === 'object') {
        g.attributes[key] = JSON.stringify(value);
      }
    });
  }
github Esri / storymap-crowdsource / src / app / components / header / Header.babel.js View on Github external
render() {

    const headerClass = Helper.classnames([this.props.className, 'header', 'navbar', 'main-app-header']);
    const participateIconHtml = {
      __html: getIcon('participate')
    };
    const participateBtn = this.props.showParticipateActionButton ? (
      <button> this.participateBtn = ref} className={Helper.classnames(['participate', 'btn', 'btn-primary', 'nav-btn'],{
          disabled: this.props.participationButtonDisabled
        })} onClick={this.participateAction}&gt;
        <span></span>
        <span>{this.props.participateShort}</span>
      </button>
    ) : null;

    const logoUrl = Helper.attachmentUtils.checkForCredential({
      url: this.props.logo.source,
      portal: this.props.portal
    });

    const includeSharing = Object.keys(this.props.sharing.services).filter((key) =&gt; {
      return this.props.sharing.services[key] === true;
    }).length &gt; 0;

    return (
      <header>
        <div>
          {this.props.logo.type === 'none' || logoUrl.length === 0 ? null : (
            <a href="{this.props.logo.link}">
              <img alt="{this.props.logo.link}" src="{logoUrl}">
            </a>
          )}</div></header>
github Esri / storymap-crowdsource / src / app / components / selectedShares / SelectedDisplay.babel.js View on Github external
let photoUrl;

        if (fieldProps.isAttachment) {
          const attachmentUrl = Helper.attachmentUtils.getAttachmentUrlsByStringMatch({
            layer: this.props.layer,
            feature: this.props.feature,
            match: media.field,
            position: 0
          })[0] || '';

          photoUrl = Helper.attachmentUtils.checkForCredential({
            url: attachmentUrl,
            layer: this.props.layer
          });
        } else {
          photoUrl = Helper.attachmentUtils.checkForCredential({
            url: this.props.thumbnailUrlPrepend + attributes[media.field] + this.props.thumbnailUrlAppend,
            layer: this.props.layer
          });
        }

        return (
          <div>
            
            
          </div>
github Esri / storymap-crowdsource / src / app / components / gallery / ThumbnailGallery.babel.js View on Github external
galleryItemRender(item,index) {
    const attr = this.props.attributePath ? Helper.objectUtils.getDescendentProperty(item,this.props.attributePath) : item;
    const endTile = index % this.state.tileSettings.tilesPerRow === 0;
    let photoUrl;

    if (this.props.thumbnailIsAttachment) {
      const attachmentUrl = Helper.attachmentUtils.getAttachmentUrlsByStringMatch({
        layer: this.props.layer,
        feature: item,
        match: this.props.thumbnailField,
        position: 0
      })[0] || '';

      photoUrl = Helper.attachmentUtils.checkForCredential({
        url: attachmentUrl,
        layer: this.props.layer
      });
    } else {
      photoUrl = Helper.attachmentUtils.checkForCredential({
        url: this.props.thumbnailUrlPrepend + attr[this.props.thumbnailField] + this.props.thumbnailUrlAppend,
        layer: this.props.layer
      });
    }

    const itemStyle = {
      height: this.state.tileSettings.tileSize,
      width: endTile ? this.state.tileSettings.tileSize - 0.5 : this.state.tileSettings.tileSize
    };

    const itemClasses = Helper.classnames(['gallery-item', {
github Esri / storymap-crowdsource / src / app / components / gallery / ThumbnailGallery.babel.js View on Github external
galleryItemRender(item,index) {
    const attr = this.props.attributePath ? Helper.objectUtils.getDescendentProperty(item,this.props.attributePath) : item;
    const endTile = index % this.state.tileSettings.tilesPerRow === 0;
    let photoUrl;

    if (this.props.thumbnailIsAttachment) {
      const attachmentUrl = Helper.attachmentUtils.getAttachmentUrlsByStringMatch({
        layer: this.props.layer,
        feature: item,
        match: this.props.thumbnailField,
        position: 0
      })[0] || '';

      photoUrl = Helper.attachmentUtils.checkForCredential({
        url: attachmentUrl,
        layer: this.props.layer
      });
    } else {
      photoUrl = Helper.attachmentUtils.checkForCredential({
        url: this.props.thumbnailUrlPrepend + attr[this.props.thumbnailField] + this.props.thumbnailUrlAppend,
        layer: this.props.layer
      });
    }