merge tmenari

This commit is contained in:
reality 2013-01-25 00:46:25 +00:00
commit bc124e50c5
3 changed files with 22 additions and 8 deletions

View File

@ -38,9 +38,24 @@ var pages = function(dbot) {
} }
}); });
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', { res.render('profile_grid', {
'name': dbot.config.name, 'name': dbot.config.name,
'connection': connection, 'connection': connection,
'nicks': nicks,
'profiles': profiles, 'profiles': profiles,
}); });
} }

View File

@ -53,7 +53,7 @@ block content
if profile.avatar if profile.avatar
img.profile_avatar.img-polaroid(src="#{profile.avatar}") img.profile_avatar.img-polaroid(src="#{profile.avatar}")
else 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 div.span9
h4 Bio h4 Bio
p #{profile.bio} p #{profile.bio}

View File

@ -18,10 +18,9 @@ block content
a(href='../connections') &laquo; Connections a(href='../connections') &laquo; Connections
ul.thumbnails ul.thumbnails
each profile, key in profiles each nick in nicks
if profile.hasOwnProperty('profile') && profile.profile.avatar
li.span2 li.span2
a.thumbnail(href='/profile/'+connection+'/'+encodeURIComponent(key)) a.thumbnail(href='/profile/'+connection+'/'+encodeURIComponent(nick))
div.imgwrap div.imgwrap
img(src="#{profile.profile.avatar}", alt="#{key}'s photo") img(src="#{profiles[nick].profile.avatar}", alt="#{profiles[nick].profile.primary}'s photo")
span.nicks #{profile.profile.primary} span.nicks #{profiles[nick].profile.primary}