src/widgets/CreateAnnotation.js
branchnew-model
changeset 915 ba7aab923d08
parent 909 aa0e42229784
child 916 ec6849bbbdcc
equal deleted inserted replaced
914:3238d1625df9 915:ba7aab923d08
   214     }
   214     }
   215     
   215     
   216     var _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager);
   216     var _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager);
   217         _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}),
   217         _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}),
   218         _annotation = new IriSP.Model.Annotation(false, _export),
   218         _annotation = new IriSP.Model.Annotation(false, _export),
   219         _annotationType = new IriSP.Model.AnnotationType(false, _export),
   219         _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type),
       
   220         _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)),
   220         _url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId});
   221         _url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId});
   221 
   222 
       
   223     if (!_annotationTypes.length) {
       
   224         _annotationType.dont_send_id = true;
       
   225     }
       
   226     
   222     _annotationType.title = this.annotation_type;
   227     _annotationType.title = this.annotation_type;
   223     _annotation.setBegin(this.begin);
   228     _annotation.setBegin(this.begin);
   224     _annotation.setEnd(this.end);
   229     _annotation.setEnd(this.end);
   225     _annotation.setMedia(this.source.currentMedia.id);
   230     _annotation.setMedia(this.source.currentMedia.id);
   226     _annotation.setAnnotationType(_annotationType.id);
   231     _annotation.setAnnotationType(_annotationType.id);