Fixed user filter on AnnotationList to not display username in the dropdown but what is displayed in the list + Added project_id to api templates for delete in case the target API understands it
authordurandn
Mon, 21 Sep 2015 18:24:32 +0200
changeset 1059 8158421193e3
parent 1058 ded3cd1312c1
child 1060 3a4f2217a04f
Fixed user filter on AnnotationList to not display username in the dropdown but what is displayed in the list + Added project_id to api templates for delete in case the target API understands it
src/widgets/AnnotationsList.js
src/widgets/Markers.js
--- a/src/widgets/AnnotationsList.js	Fri Sep 18 17:21:12 2015 +0200
+++ b/src/widgets/AnnotationsList.js	Mon Sep 21 18:24:32 2015 +0200
@@ -51,6 +51,7 @@
     annotations_count_header : true,
     show_creation_date : false,
     show_timecode : true,
+    project_id: "",
     /*
      * Only annotation in the current segment will be displayed. Designed to work with the Segments Widget.
      */
@@ -684,7 +685,7 @@
 
 IriSP.Widgets.AnnotationsList.prototype.sendDelete = function(id){
     var _this = this,
-        _url = Mustache.to_html(this.api_delete_endpoint, {annotation_id: id})
+        _url = Mustache.to_html(this.api_delete_endpoint, {annotation_id: id, project_id: this.project_id})
     
     IriSP.jQuery.ajax({
         url: _url,
@@ -724,7 +725,17 @@
             });
             this.userselect_$.html("<option selected value='false'>"+this.l10n.everyone+"</option>");
             this.usernames.forEach(function(_user){
-                _this.userselect_$.append("<option value='"+_user+"'>"+_user+"</option>");
+                var _users = _this.source.users_data.filter(function(_user_data){
+                    return _user_data.username == _user;
+                }),
+                    _user_data = {};
+                if (_users.length == 0){
+                    _user_data.username = _user;
+                }
+                else{
+                    _user_data = _users[0];
+                }
+                _this.userselect_$.append("<option value='"+_user+"'>"+_this.make_name_string_function(_user_data)+"</option>");
             });
         }
         if (this.keyword_filter){
--- a/src/widgets/Markers.js	Fri Sep 18 17:21:12 2015 +0200
+++ b/src/widgets/Markers.js	Mon Sep 21 18:24:32 2015 +0200
@@ -505,7 +505,7 @@
 
 IriSP.Widgets.Markers.prototype.sendDelete = function(){
     _this = this;
-    _url = Mustache.to_html(this.api_endpoint_template_delete, {annotation_id: this.selectedMarker ? this.selectedMarker.id : ""});
+    _url = Mustache.to_html(this.api_endpoint_template_delete, {annotation_id: this.selectedMarker ? this.selectedMarker.id : "", project_id: this.selectedMarker.project_id? this.selectedMarker.project_id : this.project_id});
     IriSP.jQuery.ajax({
         url: _url,
         type: this.api_method_delete,