src/widgets/AnnotationsList.js
changeset 1055 b45522b1b2af
parent 1053 149a4ea20ea7
child 1059 8158421193e3
equal deleted inserted replaced
1054:cfea8c04c8c7 1055:b45522b1b2af
   111         return IriSP.jQuery.ajax({
   111         return IriSP.jQuery.ajax({
   112             async: false,
   112             async: false,
   113             url: _url,
   113             url: _url,
   114             type: "GET",
   114             type: "GET",
   115             success: function(_data) {
   115             success: function(_data) {
   116                 console.log(_data)
       
   117                 _this.source.users_data = _data.objects
   116                 _this.source.users_data = _data.objects
   118             },
   117             },
   119             error: function(_xhr, _error, _thrown) {
   118             error: function(_xhr, _error, _thrown) {
   120                 console.log(_xhr)
   119                 console.log(_xhr)
   121                 console.log(_error)
   120                 console.log(_error)
   580 };
   579 };
   581 
   580 
   582 IriSP.Widgets.AnnotationsList.prototype.onDeleteClick = function(event){
   581 IriSP.Widgets.AnnotationsList.prototype.onDeleteClick = function(event){
   583     
   582     
   584     ann_id = event.target.id;
   583     ann_id = event.target.id;
   585     console.log(ann_id)
       
   586     delete_preview_$ = this.$.find(".Ldt-AnnotationsList-ul-ToDelete");
   584     delete_preview_$ = this.$.find(".Ldt-AnnotationsList-ul-ToDelete");
   587     delete_preview_$.html("");
   585     delete_preview_$.html("");
   588     _list = this.getWidgetAnnotations()
   586     _list = this.getWidgetAnnotations()
   589     _list = _list.filter(function(_annotation){
   587     _list = _list.filter(function(_annotation){
   590         return _annotation.id == ann_id
   588         return _annotation.id == ann_id
   591     })
   589     })
   592     var _annotation = _list[0],
   590     var _annotation = _list[0],
   593         _title = "",
   591         _title = "",
   594         _this = this;
   592         _this = this;
   595     console.log(_annotation)
       
   596     if (_annotation.creator) {
   593     if (_annotation.creator) {
   597         var _users = _this.source.users_data.filter(function(_user_data){
   594         var _users = _this.source.users_data.filter(function(_user_data){
   598             return _user_data.username == _annotation.creator
   595             return _user_data.username == _annotation.creator
   599         }),
   596         }),
   600             _user = {};
   597             _user = {};
   684         this.showScreen("Main");
   681         this.showScreen("Main");
   685     }
   682     }
   686 }
   683 }
   687 
   684 
   688 IriSP.Widgets.AnnotationsList.prototype.sendDelete = function(id){
   685 IriSP.Widgets.AnnotationsList.prototype.sendDelete = function(id){
   689     console.log("deleting "+id)
       
   690     var _this = this,
   686     var _this = this,
   691         _url = Mustache.to_html(this.api_delete_endpoint, {annotation_id: id})
   687         _url = Mustache.to_html(this.api_delete_endpoint, {annotation_id: id})
   692     
   688     
   693     IriSP.jQuery.ajax({
   689     IriSP.jQuery.ajax({
   694         url: _url,
   690         url: _url,