web part for ban list [#557]

This commit is contained in:
reality 2013-08-18 20:23:13 +00:00
parent 5233481992
commit fe6141ea81
4 changed files with 64 additions and 1 deletions

View File

@ -8,5 +8,6 @@
},
"chanserv": "ChanServ",
"document_bans": false,
"dbType": "redis"
"dbType": "redis",
"webAccess": "power_users"
}

29
modules/kick/pages.js Normal file
View File

@ -0,0 +1,29 @@
var _ = require('underscore')._;
var pages = function(dbot) {
return {
'/kick': function(req, res) {
res.render('servers', {
'servers': _.keys(dbot.config.servers)
});
},
'/kick/:server': function(req, res) {
var server = req.params.server,
bans = [];
this.db.search('nbans', { 'server': server }, function(ban) {
bans.push(ban);
}, function() {
res.render('bans', {
'server': server,
'bans': bans
});
});
}
}
};
exports.fetch = function(dbot) {
return pages(dbot);
};

23
views/kick/bans.jade Normal file
View File

@ -0,0 +1,23 @@
extends ../layout
block content
div#backlink
a(href='/warning/'+server) « Server Bans
p
div#profile_datatable
table.table.table-hover.data
thead
tr
th Date
th Banner
th Banee
th Host
th Reason
tbody
each ban, key in bans
tr
td #{new Date(ban.time)}
td #{ban.banner}
td #{ban.banee}
td #{ban.host}
td #{ban.reason}

10
views/kick/servers.jade Normal file
View File

@ -0,0 +1,10 @@
extends ../layout
block content
h3 Servers
div#backlink
a(href='/') « Home
ul#quotelist
-each server in servers
a(href='/kick/'+server)
li.quotes #{server}