Browse Source

Added fan-art page

doobs
Brandon Cornejo 11 years ago
parent
commit
84bfe15c54
  1. 41
      lib/web.js
  2. 4
      web/public/css/app.css
  3. 32
      web/templates/fanart.jade
  4. 1
      web/templates/layout.jade

41
lib/web.js

@ -23,43 +23,42 @@ WEB.prototype.start = function () {
__self.srv.set('views', 'web/templates'); __self.srv.set('views', 'web/templates');
__self.srv.use(express.static('./web/public')); __self.srv.use(express.static('./web/public'));
__self.render_opts = {
title: __self.title,
slogan: __self.slogan,
logo: __self.logo,
twitter: __self.twitter,
};
// ---- Routes ----- // ---- Routes -----
__self.srv.get('/', function(req, res) { __self.srv.get('/', function(req, res) {
//lets get the top 5 //lets get the top 5
sql = 'SELECT * FROM viewers ORDER BY points DESC LIMIT 10;'; sql = 'SELECT * FROM viewers ORDER BY points DESC LIMIT 10;';
__self.db.execute(sql, function(rows) { __self.db.execute(sql, function(rows) {
res.render('index', {
title: __self.title,
slogan: __self.slogan,
logo: __self.logo,
twitter: __self.twitter,
rows: rows,
});
var opts = __self.render_opts;
opts.rows = rows;
res.render('index', opts);
}); });
}); });
__self.srv.get('/ladder', function(req, res) { __self.srv.get('/ladder', function(req, res) {
//get the whole viewer list //get the whole viewer list
sql = 'SELECT * FROM viewers ORDER BY points DESC;'; sql = 'SELECT * FROM viewers ORDER BY points DESC;';
__self.db.execute(sql, function(rows) { __self.db.execute(sql, function(rows) {
res.render('ladder', {
title: __self.title,
slogan: __self.slogan,
logo: __self.logo,
twitter: __self.twitter,
rows: rows,
});
var opts = __self.render_opts;
opts.rows = rows;
res.render('ladder', opts);
}); });
}); });
__self.srv.get('/stats', function(req, res) { __self.srv.get('/stats', function(req, res) {
//get the whole viewer list
res.render('stats', {
title: __self.title,
slogan: __self.slogan,
logo: __self.logo,
twitter: __self.twitter,
statdir: __self.statdir,
var opts = __self.render_opts;
opts.statdir = __self.statdir;
res.render('stats', opts);
}); });
/* Raw data for android app */
__self.srv.get('/fanart', function(req, res) {
res.render('fanart', __self.render_opts);
}); });
__self.srv.get('/api/test', function(req, res) { __self.srv.get('/api/test', function(req, res) {
res.send("Hey, its Potatr. This data was pulled from the web."); res.send("Hey, its Potatr. This data was pulled from the web.");

4
web/public/css/app.css

@ -18,3 +18,7 @@
.uk-search-field, .uk-search-field::-moz-placeholder { .uk-search-field, .uk-search-field::-moz-placeholder {
color: #FFFFFF; color: #FFFFFF;
} }
#fan-art > a {
margin: 8px;
}

32
web/templates/fanart.jade

@ -0,0 +1,32 @@
extends layout
block content
div.uk-grid
br
br
div.uk-width-1-1.uk-text-center
h1 Potato Fan Art
div.uk-width-1-1
div#fan-art.uk-panel.uk-panel-box
block postscript
script.
var art = [
{
url: "https://pbs.twimg.com/media/BjxJdEFCcAAO15X.png:large",
user: "Hraugur",
user_link: "https://twitter.com/Hraugur"
},
{
url: "https://pbs.twimg.com/media/BjxJdEFCcAAO15X.png:large",
user: "Hraugur",
user_link: "https://twitter.com/Hraugur"
},
];
var $holder = $(".uk-panel-box");
art.forEach(function(elem) {
var $thumb = $("<a href='"+elem.url+"' class='uk-thumbnail uk-thumbnail-small'></a>");
$thumb.append("<img src='"+elem.url+"' />");
$thumb.append("<div class='uk-thumbnail-caption'>Artist: <a href='"+elem.user_link+"'>"+elem.user+"</a></div>");
$holder.append($thumb);
});

1
web/templates/layout.jade

@ -42,6 +42,7 @@ html(lang="en")
li: a(href='/') Home li: a(href='/') Home
li: a(href='/ladder') Ladder li: a(href='/ladder') Ladder
li: a(href='/stats') Chat Stats li: a(href='/stats') Chat Stats
li: a(href='/fanart') Fan Art
li: a(href='http://www.twitter.com/#{twitter}'): img(src='/img/twitter.gif', alt='Twitter') li: a(href='http://www.twitter.com/#{twitter}'): img(src='/img/twitter.gif', alt='Twitter')
div.uk-width-1-1 div.uk-width-1-1
div.uk-container.uk-container-center div.uk-container.uk-container-center

Loading…
Cancel
Save