refactored the code a bit. popcorn-port
authorhamidouk
Thu, 29 Dec 2011 17:14:10 +0100
branchpopcorn-port
changeset 548 96a188138c20
parent 547 5b58a108086a
child 549 8abffd2de54a
refactored the code a bit.
src/js/widgets/createAnnotationWidget.js
src/templates/createAnnotationWidget.html
--- a/src/js/widgets/createAnnotationWidget.js	Thu Dec 29 17:04:56 2011 +0100
+++ b/src/js/widgets/createAnnotationWidget.js	Thu Dec 29 17:14:10 2011 +0100
@@ -30,10 +30,17 @@
 IriSP.createAnnotationWidget.prototype.draw = function() {
   var _this = this;
 
-  var annotationMarkup = IriSP.templToHTML(IriSP.createAnnotationWidget_template,
-                                           {keywords: this.keywords});
+  var annotationMarkup = IriSP.templToHTML(IriSP.createAnnotationWidget_template);
 	this.selector.append(annotationMarkup);
+  
   this.selector.hide();
+  for (var i = 0; i < this.keywords.length; i++) {
+    var templ = IriSP.templToHTML("<span class='Ldt-createAnnotation-absent-keyword'>{{keyword}}</span>", 
+                                  {keyword: this.keywords[i]});
+                                  
+    this.selector.find(".Ldt-createAnnotation-keywords").append(templ);
+  }
+  
   
   this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked", 
                         IriSP.wrap(this, this.handleAnnotateSignal));  
--- a/src/templates/createAnnotationWidget.html	Thu Dec 29 17:04:56 2011 +0100
+++ b/src/templates/createAnnotationWidget.html	Thu Dec 29 17:14:10 2011 +0100
@@ -19,7 +19,6 @@
     
     <div class='Ldt-createAnnotation-keywords'>
       Add keywords :       
-      {{#keywords}}<span class='Ldt-createAnnotation-absent-keyword'>{{.}}</span>{{/keywords}}
     </div>          
     <div class='Ldt-createAnnotation-submitButton'>
       <div style='position: absolute; bottom: 10pt; right: 11pt;'>Submit</div>