src/js/widgets/tweetsWidget.js
branchtweet-widget
changeset 274 fe02d003c6c4
parent 271 41258988e132
child 275 a4d2dd99187b
--- a/src/js/widgets/tweetsWidget.js	Fri Nov 18 11:01:13 2011 +0100
+++ b/src/js/widgets/tweetsWidget.js	Fri Nov 18 11:06:55 2011 +0100
@@ -10,8 +10,14 @@
 
 IriSP.TweetsWidget.prototype.displayTweet = function(annotation) {    
     var title = annotation.content.title;
+    var img = annotation.content.img.src;
+    if (typeof(img) === "undefined" || img === "" || img === "None") {
+      img = IriSP.widgetsDefaults.TweetsWidget.default_profile_picture;
+    }
+    
     var imageMarkup = Mustache.to_html("<img src='{{src}}' alt='avatar'></img>", 
-                                       {src : annotation.content.img.src});
+                                       {src : img});
+
     this.selector.find(".Ldt-tweetContents").text(title);
     this.selector.find(".Ldt-tweetAvatar").html(imageMarkup);
     this.selector.show(50);