Permalink
Browse files

asdf

  • Loading branch information...
ericz committed Jun 24, 2012
1 parent a9c7119 commit c3769565dc25e6067fb352ea1f5a0352c4fdb993
Showing with 43 additions and 11 deletions.
  1. +1 −1 data/facebook/contacts.js
  2. +1 −0 website/public/css/style.css
  3. +5 −8 website/public/js/contact.js
  4. +29 −1 website/server.js
  5. +7 −1 website/views/dashboard.ejs
@@ -18,7 +18,7 @@ var get_friends = function (access_token, id, userId) {
// and less dependent on the format of the text
result = result.split('"id":');
result = result.join('"fbid":');
- result = JSON.parse(result).data;
+ result = JSON.parse(result).data;-
rest.postJson(post_url, result);
});
};
@@ -668,6 +668,7 @@ h2 {
background-size: cover;
position: relative;
float: left;
+ display: block;
margin: 0 2px 2px 0;
}
@@ -26,23 +26,20 @@ $(function(){
console.log(key);
plot.push(graph[key]);
}
- console.log(plot);
+ var settings = [s];
+ var s = {lineWidth:4, rendererOptions: {smooth: true}};
$.jqplot.config.enablePlugins=true;
$.jqplot('chartdiv',
plot,
{
axes: {
- xaxis: {renderer: $.jqplot.DateAxisRenderer}
+ xaxis: {renderer: $.jqplot.DateAxisRenderer},
},
- series:[{rendererOptions: {
- smooth: true
- }},{rendererOptions: {
- smooth: true
- }}
+ series: settings
- ]
+
});
});
View
@@ -160,7 +160,35 @@ app.get('/dashboard', loggedIn, function(req, res){
});
});*/
- res.render('dashboard', {js: 'dashboard', title: 'Touchbase - Dashboard'});
+ Contacts.find({userid: req.session.user._id}).toArray(function(err, docs){
+ async.forEach(docs, function(val,cb){
+ Data.findOne({userid: req.session.user._id, contactid: val._id.toString()}, {sort: {date: -1}}, function(err, last){
+ val.last = last;
+ cb(null);
+ })
+ }, function(){
+ docs.sort(function(a,b){
+
+ if(a.last && !b.last) {
+ return -1;
+ } else if (b.last && !a.last) {
+ return 1;
+ } else if (a.last && b.last) {
+ if(a.last.date > b.last.date) {
+ return -1;
+ } else if (b.last.date > a.last.date){
+ return 1;
+ } else {
+ return 0;
+ }
+ } else {
+ return 0;
+ }
+
+ });
+ res.render('dashboard', {js: 'dashboard', title: 'Touchbase - Dashboard', docs: docs});
+ });
+ });
});
app.get('/logout', loggedIn, function(req, res) {
@@ -4,8 +4,14 @@
<%-partial('usermenu.ejs')%>
<div id="main-alt" class="main-large">
- <h1></h1>
+ <h1>My contacts</h1>
+ <% for (var i =0, ii = docs.length; i < ii; i++) { %>
+ <% var doc = docs[i] %>
+ <a href="/contact/<%=doc._id.toString()%>" class="contactthumb" style="background-image:url(http://graph.facebook.com/<%=doc.fbid%>/picture?type=large)">
+ <div class="contactname"><%=doc.name%></div>
+ </a>
+ <% } %>
<div class="clear"></div>

0 comments on commit c376956

Please sign in to comment.