timeline/js/timeline.js
changeset 106 574bb047a940
parent 105 fe4b70b9991d
child 107 6b346cb90c5a
equal deleted inserted replaced
105:fe4b70b9991d 106:574bb047a940
   800 Tlns.Classes.Occurrence.prototype.toString = function() {
   800 Tlns.Classes.Occurrence.prototype.toString = function() {
   801     return "Occurrence " + this.type + ': "' + this.title + '"';
   801     return "Occurrence " + this.type + ': "' + this.title + '"';
   802 };
   802 };
   803 
   803 
   804 Tlns.Classes.Occurrence.prototype.toggleFavorite = function() {
   804 Tlns.Classes.Occurrence.prototype.toggleFavorite = function() {
   805     var newFavStatus = !this.isFavorite;
   805     var newFavStatus = !this.isFavorite,
   806     
   806         _this = this;
   807     $.ajax({
   807     $.ajax({
   808         type: "POST",
   808         type: "POST",
   809         url: this.timeline.set_favorite_endpoint,
   809         url: this.timeline.set_favorite_endpoint,
   810         data: {
   810         data: {
   811             type: this.type,
   811             type: this.type,
   813             status: +newFavStatus,
   813             status: +newFavStatus,
   814             uid: this.timeline.user_id || undefined
   814             uid: this.timeline.user_id || undefined
   815         },
   815         },
   816         success: function(r) {
   816         success: function(r) {
   817             console.log(r);
   817             console.log(r);
       
   818             /* DEPENDING ON THE RESULT.... */
   818             _this.isFavorite = newFavStatus;
   819             _this.isFavorite = newFavStatus;
   819             _this.timeline.throttledDrawGrid();
   820             _this.timeline.throttledDrawGrid();
   820         }
   821         }
   821     });
   822     });
   822     
   823