converted the tweet widget to use the new template engine. removed a template of popcorn-port
authorhamidouk
Wed, 30 Nov 2011 16:13:59 +0100
branchpopcorn-port
changeset 363 8d4b329836b6
parent 362 0b1bf06c28ed
child 364 eb9977188c7d
converted the tweet widget to use the new template engine. removed a template of dubious value.
src/js/widgets/tweetsWidget.js
src/templates/rich_tweet.html
src/templates/tweetWidget.html
--- a/src/js/widgets/tweetsWidget.js	Wed Nov 30 16:13:22 2011 +0100
+++ b/src/js/widgets/tweetsWidget.js	Wed Nov 30 16:13:59 2011 +0100
@@ -19,18 +19,19 @@
       img = IriSP.widgetsDefaults.TweetsWidget.default_profile_picture;
     }
 
-    var imageMarkup = Mustache.to_html("<img src='{{src}}' alt='user image'></img>", 
+    var imageMarkup = IriSP.templToHTML("<img src='{{src}}' alt='user image'></img>", 
                                        {src : img});
     
     if (typeof(annotation.meta["dc:source"].content) !== "undefined") {
       var tweetContents = JSON.parse(annotation.meta["dc:source"].content);
       var creator = tweetContents.user.screen_name;
       
-      imageMarkup = Mustache.to_html("<a href='http://twitter.com/{{creator}}'><img src='{{src}}' alt='user image'></img></a>", 
+      imageMarkup = IriSP.templToHTML("<a href='http://twitter.com/{{creator}}'><img src='{{src}}' alt='user image'></img></a>", 
                                        {src : img, creator: creator});
             
       var formatted_date = new Date(tweetContents.created_at).toLocaleDateString();
-      title = Mustache.to_html(IriSP.rich_tweet_template, {contents : title, date : formatted_date});
+      title = IriSP.templToHTML("<div class='Ldt-tweet_tweetContents'>{{{ contents }}}</div><div class='Ldt-tweet_date'>{{ date }}</div>", 
+                                {contents : title, date : formatted_date});
     }
 
     this.selector.find(".Ldt-tweetContents").html(title);
@@ -73,7 +74,7 @@
 IriSP.TweetsWidget.prototype.draw = function() {
   var _this = this;
   
-  var tweetMarkup = Mustache.to_html(IriSP.tweetWidget_template, {"share_template" : IriSP.share_template});
+  var tweetMarkup = IriSP.templToHTML(IriSP.tweetWidget_template, {"share_template" : IriSP.share_template});
   this.selector.append(tweetMarkup);
   this.selector.hide();
   this.selector.find(".Ldt-tweetWidgetMinimize").click(IriSP.wrap(this, this.closePanel));
--- a/src/templates/rich_tweet.html	Wed Nov 30 16:13:22 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-{{! template of a 'rich' tweet displayed by the tweetsWidget 
-    It's used only when we have access to the twitter api data (normally stored into
-    dc:source.content)
-}}
-
-<div class='Ldt-tweet_tweetContents'>{{{ contents }}}</div>
-<div class='Ldt-tweet_date'>{{ date }}</div>
\ No newline at end of file
--- a/src/templates/tweetWidget.html	Wed Nov 30 16:13:22 2011 +0100
+++ b/src/templates/tweetWidget.html	Wed Nov 30 16:13:59 2011 +0100
@@ -1,10 +1,11 @@
 {{! template for the tweet widget }}
 <div class='Ldt-tweetWidget'>
-  <div class='Ldt-tweetWidgetMinimize'></div>
-  <div class='Ldt-tweetAvatar'>
-
-  </div>
+  <img src='{{img_dir}}/minimize.png' class='Ldt-tweetWidgetMinimize' alt='minimize window'></img>
+  <div class='Ldt-tweetAvatar'></div>
+  <img src='{{img_dir}}/profile_arrow.png' class='Ldt-tweetAvatar-profileArrow'></img>
   <div class='Ldt-tweetContents'>
 
   </div>
+  <div class='Ldt-Retweet'><div class='Ldt-RetweetIcon'></div> - Retweet </div>
+  <div class='Ldt-TweetReply'><div class='Ldt-TweetReplyIcon'></div> - Reply</div>
 </div>