--- a/src/widgets/CurrentSegmentInfobox.js Fri Sep 25 10:44:54 2015 +0200
+++ b/src/widgets/CurrentSegmentInfobox.js Fri Sep 25 14:45:38 2015 +0200
@@ -218,9 +218,9 @@
new_description = this.$.find(".Ldt-CurrentSegmentInfobox-DescriptionInput").val()
var _this = this,
- _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* Création d'une liste d'annotations contenant une annotation afin de l'envoyer au serveur */
- _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}),
- _annotation = new IriSP.Model.Annotation(this.currentSegment.id, _export); /* Création d'une annotation dans cette source avec un ID généré à la volée (param. false) */
+ _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* We create an Annotations List to send to the server */
+ _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* We create a source object using a specific serializer for export */
+ _annotation = new IriSP.Model.Annotation(this.currentSegment.id, _export); /* We create an annotation in the source with a generated ID (param. false) */
_annotation.setAnnotationType(this.currentSegment.getAnnotationType().id);
_annotation.setMedia(this.currentSegment.getMedia().id);
@@ -228,8 +228,8 @@
_annotation.setEnd(this.currentSegment.end);
_annotation.created = this.currentSegment.created;
_annotation.creator = this.currentSegment.creator;
- _annotation.title = new_title /* Champ titre */
- _annotation.description = new_description /* Champ description */
+ _annotation.title = new_title /* Title field */
+ _annotation.description = new_description /* Description field */
var _tagIds = IriSP._(new_tags_titles).map(function(_title) {
var _tags = _this.source.getTags(true).searchByTitle(_title, true);
if (_tags.length) {
@@ -245,8 +245,8 @@
_annotation.setTags(_tagIds);
_annotation.project_id = this.project_id;
- _exportedAnnotations.push(_annotation); /* Ajout de l'annotation à la liste à exporter */
- _export.addList("annotation",_exportedAnnotations); /* Ajout de la liste à exporter à l'objet Source */
+ _exportedAnnotations.push(_annotation); /* We add the annotation in the list to export */
+ _export.addList("annotation",_exportedAnnotations); /* We add the list to the source object */
_url = Mustache.to_html(this.api_endpoint_template, {annotation_id: this.currentSegment.id});
@@ -254,11 +254,11 @@
url: _url,
type: this.api_method,
contentType: 'application/json',
- data: _export.serialize(), /* L'objet Source est sérialisé */
+ data: _export.serialize(), /* Source is serialized */
success: function(_data) {
- _export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */
- _export.deSerialize(_data); /* On désérialise les données reçues pour les réinjecter */
- _this.source.merge(_export); /* On récupère les données réimportées dans l'espace global des données */
+ _export.getAnnotations().removeElement(_annotation, true); /* We delete the sent annotation to avoid redundancy */
+ _export.deSerialize(_data); /* Data deserialization */
+ _this.source.merge(_export); /* We merge the deserialized data with the current source data */
_this.segments.forEach(function(_segment){
if (_segment.id == _annotation.id){
_this.segments.removeElement(_segment)