From 9e7654fa9aaf4ccb3a2c2f89060bb04204770deb Mon Sep 17 00:00:00 2001 From: psychobunny Date: Thu, 2 May 2013 20:11:14 +0000 Subject: [PATCH] template example for user --- public/templates/home.tpl | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/public/templates/home.tpl b/public/templates/home.tpl index 48aeda29fa..5b6d73797f 100644 --- a/public/templates/home.tpl +++ b/public/templates/home.tpl @@ -3,7 +3,7 @@
  • {topics.title}

    -

    Posted {topics.relativeTime} by user . {topics.post_count} posts.

    +

    Posted {topics.relativeTime} by user {topics.uid}. {topics.post_count} posts.

  • @@ -14,15 +14,21 @@ new_post.onclick = function() { } jQuery('document').ready(function() { - var userId = {topics.uid}; - - socket.on('api:user.get', function(userObj) { - console.log("derp"); - console.log(userObj); + jQuery('.username').each(function() { + var userId = this.innerHTML; + + socket.on('api:user.get', function(userObj) { + console.log("derp"); + console.log(userObj); + + }); - }); + socket.emit('api:user.get', { fields: [ 'uid' ], 'uid': userId }); + + }) + + - socket.emit('api:user.get', { fields: [ 'uid' ], 'uid': userId }); });