timeline/js/timeline.js
changeset 103 b9a417017e19
parent 102 2f1ef2ded30c
child 104 3fef455d214a
equal deleted inserted replaced
102:2f1ef2ded30c 103:b9a417017e19
   619                 _(_this.occurrences).each(function(_occ) {
   619                 _(_this.occurrences).each(function(_occ) {
   620                     _occ.editing = false;
   620                     _occ.editing = false;
   621                 });
   621                 });
   622                 _this.editing_occurrence.editing = true;
   622                 _this.editing_occurrence.editing = true;
   623                 _this.$.find(".Tl-Details").html(Mustache.to_html(Tlns.Templates.OccurrenceDetails, _this.editing_occurrence));
   623                 _this.$.find(".Tl-Details").html(Mustache.to_html(Tlns.Templates.OccurrenceDetails, _this.editing_occurrence));
       
   624                 _this.$.find(".Tl-Detail-Favorite").click(function() {
       
   625                     _this.editing_occurrence.toggleFavorite();
       
   626                 }).hover(function() {
       
   627                     $(this)[_this.editing_occurrence.isFavorite ? "removeClass" : "addClass" ]("Tl-Detail-isFavorite");
       
   628                 }, function() {
       
   629                     $(this)[_this.editing_occurrence.isFavorite ? "addClass" : "removeClass"]("Tl-Detail-isFavorite");
       
   630                 });
   624             }
   631             }
   625             _this.throttledDrawGrid();
   632             _this.throttledDrawGrid();
   626         }
   633         }
   627     }).mouseover(function(_event) { // Hover sur un contenu
   634     }).mouseover(function(_event) { // Hover sur un contenu
   628         var _el = $(this),
   635         var _el = $(this),
   729 };
   736 };
   730 
   737 
   731 Tlns.Classes.Occurrence.prototype.toString = function() {
   738 Tlns.Classes.Occurrence.prototype.toString = function() {
   732     return "Occurrence " + this.type + ': "' + this.title + '"';
   739     return "Occurrence " + this.type + ': "' + this.title + '"';
   733 };
   740 };
       
   741 
       
   742 Tlns.Classes.Occurrence.prototype.toggleFavorite = function() {
       
   743     var newFavStatus = !this.isFavorite;
       
   744     /* Add API Call HERE */
       
   745     
       
   746     /* The Following status update should be moved to the SUCCESS callback of the API call */
       
   747     this.isFavorite = newFavStatus;
       
   748     this.timeline.throttledDrawGrid();
       
   749 };