From c64943994794342867bd88e1789a62aefcc22816 Mon Sep 17 00:00:00 2001 From: Sam Nicholls Date: Thu, 10 Jan 2013 22:23:51 +0000 Subject: [PATCH] Improve online users UI [REQ Bootstrap] --- modules/users/web.js | 53 +++++++++++++++++++++++++----------------- public/styles.css | 12 +++++----- views/layout.jade | 15 ++++++++---- views/users/users.jade | 37 ++++++++++++++++++++--------- 4 files changed, 74 insertions(+), 43 deletions(-) diff --git a/modules/users/web.js b/modules/users/web.js index a40de06..9028553 100644 --- a/modules/users/web.js +++ b/modules/users/web.js @@ -25,33 +25,44 @@ var pages = function(dbot) { if(connections.hasOwnProperty(connection) && connections[connection].channels.hasOwnProperty(channel)) { + var userData = { "active": [], "inactive": [], "offline": []}; var channelUsers = dbot.db.knownUsers[connection].channelUsers[channel]; - var usersData = {}; - for(var i=0;i y) return 1; + if(x < y) return -1; + return 0; + } + userData.active.sort(userSort); + userData.inactive.sort(userSort); + userData.offline.sort(userSort); res.render('users', { 'name': dbot.config.name, 'connection': connection, - 'channel': channel, 'nicks': usersData }); + 'channel': channel, 'nicks': userData }); } else { res.render_core('error', { 'name': dbot.config.name, 'message': 'No such connection or channel.' }); } diff --git a/public/styles.css b/public/styles.css index fa45ded..f1c40eb 100644 --- a/public/styles.css +++ b/public/styles.css @@ -6,19 +6,19 @@ */ html { - background: url("background.jpg") no-repeat center center fixed; - -webkit-background-size: cover; - -moz-background-size: cover; - -o-background-size: cover; - background-size: cover; } body { padding: 25px; margin: 0; - font-family: "Lucida Grande"; + font-family: "Source Sans Pro", sans-serif; color: #444; text-shadow: 1px 1px 2px #2B2B2B; + background: url("background.jpg") no-repeat center center fixed; + -webkit-background-size: cover; + -moz-background-size: cover; + -o-background-size: cover; + background-size: cover; } h1,h2 { diff --git a/views/layout.jade b/views/layout.jade index 7fc3c1d..f895402 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -2,12 +2,17 @@ html(lang='en') head meta(charset='utf-8') + link(rel="stylesheet", type="text/css", href="http://fonts.googleapis.com/css?family=Source+Sans+Pro") + link(rel="stylesheet", type="text/css", href="/bootstrap/css/bootstrap.min.css") link(rel='stylesheet', type='text/css', href='/styles.css') title #{name} web interface body - div#page - div#title - a(href='/') #{name} web interface - div#main - block content + div.container + div#page + div#title + a(href='/') #{name} web interface + div#main + block content + script(type="text/javascript", src="/bootstrap/js/bootstrap.min.js") script(type="text/javascript", src="/script.js") + diff --git a/views/users/users.jade b/views/users/users.jade index b197b23..8770dcb 100644 --- a/views/users/users.jade +++ b/views/users/users.jade @@ -4,14 +4,29 @@ block content h3 Users of #{channel} on #{connection} div#backlink a(href='/channels/'+connection) « Channel List - ul#quotelist - -each nick in nicks - if nicks.hasOwnProperty(nick.name) - a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick.name) - if nick.online - if nick.active - li.quotes #{nick.name} (Online, Active) - else - li.quotes #{nick.name} (Online, Inactive) - else - li.quotes #{nick.name} (Offline) + div#row + table.table.table-striped + thead + tr: th Users + tbody + -each nick in nicks.active + tr + td + a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick) + #{nick} + span + span.label.label-success Active + -each nick in nicks.inactive + tr + td + a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick) + #{nick} + span + span.label.label-important Inactive + -each nick in nicks.offline + tr + td + a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick) + #{nick} + span + span.label Offline