_submitSearch: function(e) {
   var search = this._$searchInput().val().trim();
   this.pagedSearchModel.set({
     q: Utils.stripHTML(search),
     page: 1
   })
   this.pagedSearchModel.fetch(this.organizationUsers);
 },
Example #2
0
 _submitSearch: function(e) {
   this.killEvent(e);
   this._navigateToUrl({
     search: Utils.stripHTML(this.$('.js-search-input').val().trim(),''),
     liked: false,
     shared: 'no',
     library: false
   });
 },
Example #3
0
var _parseDescription = function (author, description) {
  var createdByAuthor = _t('helpers.static_header_meta_tags.map_created_by', {
    author: author
  });

  return description
    ? Utils.stripHTML(markdown.toHTML(description)) + ' — ' + createdByAuthor
    : createdByAuthor;
}
 _submitSearch: function(e) {
   var search = this.$('.js-search-input').val().trim();
   this.organizationUsers
     .setParameters({
       q: Utils.stripHTML(search),
       page: 1
     })
     .fetch();
 },
Example #5
0
  _submitSearch: function(e) {
    this.killEvent(e);

    this.model.set('is_searching', true);

    this.collection.options.set({
      q: Utils.stripHTML(this.$('.js-search-input').val().trim(),''),
      page: 1
    });

    this.render();
  },
Example #6
0
  render: function() {
    var vis = this.model;
    var table = this.table;
    var tags = vis.get('tags') || [];
    var description = vis.get('description') && Utils.stripHTML(markdown.toHTML(vis.get('description'))) || '';

    var d = {
      isRaster:                vis.get('kind') === 'raster',
      geometryType:            table.geomColumnTypes().length > 0 ? table.geomColumnTypes()[0] : '',
      title:                   vis.get('name'),
      isOwner:                 vis.permission.isOwner(this.user),
      owner:                   vis.permission.owner.renderData(this.user),
      showPermissionIndicator: !vis.permission.hasWriteAccess(this.user),
      description:             description,
      privacy:                 vis.get('privacy').toLowerCase(),
      likes:                   vis.get('likes') || 0,
      timeDiff:                moment(vis.get('updated_at')).fromNow(),
      tags:                    tags,
      tagsCount:               tags.length,
      maxTagsToShow:           3,
      rowCount:                undefined,
      datasetSize:             undefined,
      syncStatus:              undefined,
      syncRanAt:               undefined
    };

    var rowCount = table.get('row_count');
    if (rowCount >= 0) {
      d.rowCount = ( rowCount < 10000 ? Utils.formatNumber(rowCount) : Utils.readizableNumber(rowCount) );
      d.pluralizedRows = pluralizeString('Row', rowCount);
    }

    var datasetSize = table.get('size');
    if (datasetSize >= 0) {
      d.datasetSize = Utils.readablizeBytes(datasetSize, true);
    }

    if (!_.isEmpty(vis.get("synchronization"))) {
      d.syncRanAt = moment(vis.get("synchronization").ran_at || new Date()).fromNow();
      d.syncStatus = vis.get("synchronization").state;
    }

    this.$el.html(this.template(d));

    this._renderLikesIndicator();
    this._renderTooltips();

    // Item selected?
    this.$el[ vis.get('selected') ? 'addClass' : 'removeClass' ]('is--selected');

    return this;
  },
Example #7
0
  _submitSearch: function(e) {
    if (e) this.killEvent(e);
    var val = Utils.stripHTML(this.$('.js-search-input').val().trim(),'');
    var tag = val.search(':') === 0 ? val.replace(':', '') : '';
    var q = val.search(':') !== 0 ? val : '';

    this.routerModel.set({
      tag: tag,
      q: q,
      shared: 'yes'
    });

    this.createModel.set('listing', 'datasets');
  }
  render: function () {
    var baseUrl = this.user.get('base_url');
    var createdByInfo = 'Map created by ' + this.user.get('username') + ' in CARTO';
    var description = this.vizdata.description
      ? Utils.stripHTML(markdown.toHTML(this.vizdata.description) + ' ' + createdByInfo)
      : createdByInfo;

    var encodedName = window.encodeURI(this.vizdata.name);
    var encodedUrl = window.encodeURI(baseUrl + '/viz/' + this.vizdata.id + '/public_map');
    var encodedDescription = window.encodeURI(description);

    this.clearSubViews();

    this.$el.html(this.template({
      baseUrl: baseUrl,
      editUrl: baseUrl + '/viz/' + this.vizdata.id + '/map',
      embedMapUrl: baseUrl + '/viz/' + this.vizdata.id + '/embed_map',
      likesCount: this.likeModel.get('likes'),
      likeURL: this.likeURL,
      liked: this.likeModel.get('liked'),
      shareFacebook: encodedUrl,
      shareLinkedIn: encodedUrl + '&title=' + encodedName + '&summary=' + encodedDescription + '&source=CARTO',
      shareTwitter: encodedName + '&url=' + encodedUrl + '&via=CARTO',
      userAvatar: this.user.get('avatar_url'),
      userName: this.user.nameOrUsername(),
      vizId: this.vizdata.id
    }));

    if (this.currentUser && this.currentUser.get('username') === this.user.get('username')) {
      this.$('.js-Navmenu-editLink').addClass('is-active');
    }

    this.userShareView = new UserShareView({
      el: this.$('.js-Navmenu-share'),
      model: new cdb.core.Model({
        active: false
      })
    });
    this.addView(this.userShareView);

    this.likesView = new cdb.open.LikeView({
      el: this.$('.js-like'),
      auto_fetch: true,
      model: this.likeModel
    });
    this.addView(this.likesView);

    return this;
  },
Example #9
0
  _changeRouteToTag: function(contentType, tag, page) {
    page = this._getPage(page);

    this.model.set({
      action:         'tag',
      content_type:   contentType,
      tag:            Utils.stripHTML(decodeURIComponent(tag),''),
      q:              '',
      page:           page,
      shared:         'yes',
      locked:         null,
      liked:          null,
      library:        null
    });
  },
  render: function() {
    var vis = this.model;
    var table = this.table;
    var tags = vis.get('tags') || [];
    var description = vis.get('description') && Utils.stripHTML(markdown.toHTML(vis.get('description'))) || '';
    var source = vis.get('source') && markdown.toHTML(vis.get('source')) || '';

    var d = {
      isRaster:                vis.get('kind') === 'raster',
      geometryType:            table.statsGeomColumnTypes().length > 0 ? table.statsGeomColumnTypes()[0] : '',
      title:                   vis.get('display_name') || vis.get('name'),
      source:                  source,
      description:             description,
      timeDiff:                moment(vis.get('updated_at')).fromNow(),
      tags:                    tags,
      tagsCount:               tags.length,
      router:                  this.router,
      maxTagsToShow:           3,
      canImportDataset:        this._canImportDataset(),
      rowCount:                undefined,
      datasetSize:             undefined,
      fromExternalSource:      ""
    };

    var rowCount = table.get('row_count');
    if (rowCount >= 0) {
      d.rowCount = ( rowCount < 10000 ? Utils.formatNumber(rowCount) : Utils.readizableNumber(rowCount) );
      d.pluralizedRows = pluralizeString('Row', rowCount);
    }

    if (!_.isEmpty(vis.get("synchronization"))) {
      d.fromExternalSource = vis.get("synchronization").from_external_source;
    }

    var datasetSize = table.get('size');
    if (datasetSize >= 0) {
      d.datasetSize = Utils.readablizeBytes(
        datasetSize,
        datasetSize.toString().length > 9 ? false : true
      );
    }

    this.$el.html(this.template(d));
    this._setItemClasses();
    this._renderTooltips();

    return this;
  },
Example #11
0
  _changeRouteToSearch: function(contentType, q, page) {
    page = this._getPage(page);

    this.model.set({
      action:         'search',
      content_type:   contentType,
      q:              Utils.stripHTML(decodeURIComponent(q),''),
      tag:            '',
      page:           page,
      shared:         'yes',
      locked:         null,
      liked:          null,
      library:        null,
      deepInsights:   false
    });
  },
var _parsedDescription = function (description) {
  return description
    ? Utils.stripHTML(markdown.toHTML(description))
    : null;
};