From 1c0e258c5808102ec61f41076063e631df42a241 Mon Sep 17 00:00:00 2001 From: Thomas Menari Date: Thu, 24 Jan 2013 23:26:23 +0000 Subject: [PATCH 1/2] placeholder deserves img-polaroid too --- views/profile/profile.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/profile/profile.jade b/views/profile/profile.jade index 108dad7..8588105 100644 --- a/views/profile/profile.jade +++ b/views/profile/profile.jade @@ -53,7 +53,7 @@ block content if profile.avatar img.profile_avatar.img-polaroid(src="#{profile.avatar}") else - img.profile_avatar(src="http://placehold.it/270x180&text=Hello,%20World") + img.profile_avatar.img-polaroid(src="http://placehold.it/270x180&text=Hello,%20World") div.span9 h4 Bio p #{profile.bio} From f03dfd91118ade9a131fe829f743a38479746c1d Mon Sep 17 00:00:00 2001 From: Thomas Menari Date: Fri, 25 Jan 2013 00:30:09 +0000 Subject: [PATCH 2/2] sort photos by primary --- modules/profile/pages.js | 14 ++++++++++++++ views/profile/profile_grid.jade | 13 ++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/modules/profile/pages.js b/modules/profile/pages.js index 96acbed..cac6a75 100644 --- a/modules/profile/pages.js +++ b/modules/profile/pages.js @@ -27,9 +27,23 @@ var pages = function(dbot) { var connection = req.params.connection; var profiles = dbot.db.profiles[connection]; + var nicks = []; + for (var p in profiles) { + if (profiles.hasOwnProperty(p) && profiles[p].profile.avatar) { + nicks.push(p); + } + } + nicks.sort(function(a, b) { + var x = profiles[a].profile.primary.toLowerCase(); + var y = profiles[b].profile.primary.toLowerCase(); + if(x > y) return 1; + if(x < y) return -1; + return 0; + }); res.render('profile_grid', { 'name': dbot.config.name, 'connection': connection, + 'nicks': nicks, 'profiles': profiles, }); } diff --git a/views/profile/profile_grid.jade b/views/profile/profile_grid.jade index 74a1693..ba7b108 100644 --- a/views/profile/profile_grid.jade +++ b/views/profile/profile_grid.jade @@ -18,10 +18,9 @@ block content a(href='../connections') « Connections ul.thumbnails - each profile, key in profiles - if profile.hasOwnProperty('profile') && profile.profile.avatar - li.span2 - a.thumbnail(href='/profile/'+connection+'/'+encodeURIComponent(key)) - div.imgwrap - img(src="#{profile.profile.avatar}", alt="#{key}'s photo") - span.nicks #{profile.profile.primary} + each nick in nicks + li.span2 + a.thumbnail(href='/profile/'+connection+'/'+encodeURIComponent(nick)) + div.imgwrap + img(src="#{profiles[nick].profile.avatar}", alt="#{profiles[nick].profile.primary}'s photo") + span.nicks #{profiles[nick].profile.primary}