Example #1
1
  zoom() {
    window.currentScollPosition = $(window.document).scrollTop();
    if (this.model.get('id') !== undefined) {
      Backbone.history.navigate('/item/' + this.model.get('id'), true);
    }
    return false;
  },

  isVisible() {
    const rect = this.el.getBoundingClientRect();
    const viewportHeight = window.innerHeight || document.documentElement.clientHeight + 50;
    return (rect.top >= -50) && (rect.top <= viewportHeight) || (rect.bottom >= -50) && (rect.bottom <= viewportHeight);
  },

  iLikeIt(e) {
    if (!visitor.doesLike(this.model.get('id'))) {
      visitor.addLike(this.model.get('id'));
      let like = new Like({ 'itemId': this.model.get('id') });
      like.save({ 'visitorId': visitor.getUuid() }, {
        'success': () => {
          this.model.set('likes', parseInt(this.model.get('likes'), 10) + 1);
          this.render();
        }
      });
    }
    this.render();
    e.stopImmediatePropagation();
  }
});
		like: function() {
			var like = new LikeModel({
				module_id: LikeModel.Module.Article,
				entry_id: this.get('id')
			});
			like.save();
			this.set('isLiked', true);
		},
Example #3
0
      item: this.item.toJSON(),
      admin: tools.isLogged(),
      labels: labels
    }));
    this.root.html(this.el);
    this.delegateEvents(this.events);
    this.$('input').focus();
  },

  iLikeIt() {
    if (!visitor.doesLike(this.item.get('id'))) {
      visitor.addLike(this.item.get('id'));
      let like = new Like({ 'itemId': this.item.get('id') });
      like.save({ 'visitorId': visitor.getUuid() }, {
        'success': () => {
          this.item.set('likes', parseInt(this.item.get('likes'), 10) + 1);
          this.renderZoom(this.item);
        }
      });
    }
  },

  upload() {
    if (!tools.isLogged()) {
      this.showLogin();
    }
    else {
      const videoUploadView = new UploadVideoView();
      $('body').append(videoUploadView.el);
    }
  },