src/js/widgets/helloWorldWidget.js
branchnew-model
changeset 870 2c025db10a10
parent 868 a525cc2214e7
--- a/src/js/widgets/helloWorldWidget.js	Tue Apr 17 20:19:46 2012 +0200
+++ b/src/js/widgets/helloWorldWidget.js	Wed Apr 18 18:58:44 2012 +0200
@@ -1,15 +1,30 @@
-IriSP.HelloWorldWidget = function(Popcorn, config, Serializer) {
-  IriSP.Widget.call(this, Popcorn, config, Serializer);
+IriSP.i18n.addMessages({
+    "fr": {
+        "Hello" : "Bonjour,"
+    },
+    "en" : {
+        "Hello" : "Hello,"
+    }
+})
+
+IriSP.HelloWorldWidget = function(player, config) {
+    console.log("Calling IriSP.Widget's constructor from IriSP.HelloWorldWidget");
+    IriSP.Widget.call(this, player, config);
+    if (typeof this.text == "undefined") {
+        this.text = 'world'
+    }
 }
 
 IriSP.HelloWorldWidget.prototype = new IriSP.Widget();
 
 IriSP.HelloWorldWidget.prototype.draw = function() {
-    this.selector
-        .append('Hello, world')
-        .css({
-            "text-align" : "center",
-            "padding": "10px 0",
-            "font-size" : "14px"
-        });
+    var _tmpl = '<p>{{l10n.Hello}} {{text}}</p><p>Looks like we have {{source.contents.annotation.length}} annotations in this feed</p>'
+        _html = IriSP.templToHTML(_tmpl, this);
+    this.$.append(_html);
+    this.$.find('p').css({
+        "text-align" : "center",
+        "margin": "10px 0",
+        "font-size" : "14px"
+    });
+    console.log("HelloWorldWidget was drawn");
 }