From 078f3b943bbd5b8c3007eed6b6a2533e2e13a2fb Mon Sep 17 00:00:00 2001 From: Sam Nicholls Date: Tue, 15 Jan 2013 20:44:15 +0000 Subject: [PATCH] Better users web --- modules/users/pages.js | 4 +++- views/users/users.jade | 44 ++++++++---------------------------------- 2 files changed, 11 insertions(+), 37 deletions(-) diff --git a/modules/users/pages.js b/modules/users/pages.js index cbc14f6..2708fd8 100644 --- a/modules/users/pages.js +++ b/modules/users/pages.js @@ -58,8 +58,10 @@ var pages = function(dbot) { userData.inactive.sort(userSort); userData.offline.sort(userSort); + var userDataSorted = (userData.active.concat(userData.inactive)).concat(userData.offline); + res.render('users', { 'name': dbot.config.name, 'connection': connection, - 'channel': channel, 'nicks': userData }); + 'channel': channel, 'nicks': userDataSorted }); } else { res.render_core('error', { 'name': dbot.config.name, 'message': 'No such connection or channel.' }); } diff --git a/views/users/users.jade b/views/users/users.jade index 9a5da2a..07dbe15 100644 --- a/views/users/users.jade +++ b/views/users/users.jade @@ -15,47 +15,19 @@ block content th Verbosity th Mentions tbody - -each nick in nicks.active + -each nick in nicks tr td a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick.primary) #{nick.display} span - span.label.label-success Active - td - #{nick.fields.lines.data} - td - #{nick.fields.words.data} - td - #{nick.fields.lincent.data} - td - #{nick.fields.wpl.data} - td - #{nick.fields.in_mentions.data} - -each nick in nicks.inactive - tr - td - a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick.primary) - #{nick.display} - span - span.label.label-important Inactive - td - #{nick.fields.lines.data} - td - #{nick.fields.words.data} - td - #{nick.fields.lincent.data} - td - #{nick.fields.wpl.data} - td - #{nick.fields.in_mentions.data} - -each nick in nicks.offline - tr - td - a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick.primary) - #{nick.display} - span - span.label Offline + if nick.online + if nick.active + span.label.label-success Active + else + span.label.label-important Inactive + else + span.label Offline td #{nick.fields.lines.data} td