From 88d2abab58d5b2d44d1527fa4f5279f39449d0a1 Mon Sep 17 00:00:00 2001 From: Daniel Evans Date: Mon, 24 Dec 2012 04:06:04 +0000 Subject: [PATCH] Removed sass compiler usage from web.js, updated jade templates to use blocks --- modules/web/web.js | 3 +-- views/channels.jade | 17 +++++++------ views/connections.jade | 13 ++++++---- views/index.jade | 5 +++- views/layout.jade | 2 +- views/polllist.jade | 19 +++++++++------ views/quotelist.jade | 19 +++++++++------ views/quotes.jade | 55 ++++++++++++++++++++++-------------------- views/user.jade | 21 +++++++++------- views/users.jade | 17 +++++++------ 10 files changed, 97 insertions(+), 74 deletions(-) diff --git a/modules/web/web.js b/modules/web/web.js index 9f01c8d..9fc3f3c 100644 --- a/modules/web/web.js +++ b/modules/web/web.js @@ -2,9 +2,8 @@ var express = require('express'); var webInterface = function(dbot) { var pub = 'public'; - var app = express.createServer(); + var app = express(); - app.use(express.compiler({ src: pub, enable: ['sass'] })); app.use(express.static(pub)); app.set('view engine', 'jade'); diff --git a/views/channels.jade b/views/channels.jade index d0e3faa..7cebf54 100644 --- a/views/channels.jade +++ b/views/channels.jade @@ -1,7 +1,10 @@ -h3 Channels on #{connection} -div#backlink - a(href='/connections') « Connection List -ul#quotelist - -each channel in channels - a(href='/users/'+connection+'/'+channel.substr(1,channel.length)) - li.quotes #{channel} +extends layout + +block content + h3 Channels on #{connection} + div#backlink + a(href='/connections') « Connection List + ul#quotelist + -each channel in channels + a(href='/users/'+connection+'/'+channel.substr(1,channel.length)) + li.quotes #{channel} diff --git a/views/connections.jade b/views/connections.jade index f4e1531..dd1e63b 100644 --- a/views/connections.jade +++ b/views/connections.jade @@ -1,6 +1,9 @@ -h3 Current Connections -div#backlink - a(href='/') « Home +extends layout + +block content + h3 Current Connections + div#backlink + a(href='/') « Home #modulelinks - -each connection in connections - a.module(href='/channels/'+connection) #{connection} + -each connection in connections + a.module(href='/channels/'+connection) #{connection} diff --git a/views/index.jade b/views/index.jade index 4558fbf..05d931e 100644 --- a/views/index.jade +++ b/views/index.jade @@ -1,4 +1,7 @@ -#modulelinks +extends layout + +block content + #modulelinks a.module(href='/quotes') Quotes a.module(href='/polls') Polls a.module(href='/connections') Users diff --git a/views/layout.jade b/views/layout.jade index be03d24..7fc3c1d 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -9,5 +9,5 @@ html(lang='en') div#title a(href='/') #{name} web interface div#main - !{body} + block content script(type="text/javascript", src="/script.js") diff --git a/views/polllist.jade b/views/polllist.jade index 4de9297..128458a 100644 --- a/views/polllist.jade +++ b/views/polllist.jade @@ -1,9 +1,12 @@ -div#backlink - a(href='/') « Home -div#controls - input(type="text", name="search", id="search-text", oninput="search(this.value)") -ul#quotelist - -each poll in polllist - a(href='/polls/'+poll) - li.quotes #{poll} +extends layout + +block content + div#backlink + a(href='/') « Home + div#controls + input(type="text", name="search", id="search-text", oninput="search(this.value)") + ul#quotelist + -each poll in polllist + a(href='/polls/'+poll) + li.quotes #{poll} diff --git a/views/quotelist.jade b/views/quotelist.jade index 9643069..df97c7b 100644 --- a/views/quotelist.jade +++ b/views/quotelist.jade @@ -1,9 +1,12 @@ -div#backlink - a(href='/') « Home -div#controls - input(type="text", name="search", id="search-text", oninput="search(this.value)") -ul#quotelist - -each quote in quotelist - a(href='/quotes/'+quote) - li.quotes #{quote} +extends layout + +block content + div#backlink + a(href='/') « Home + div#controls + input(type="text", name="search", id="search-text", oninput="search(this.value)") + ul#quotelist + -each quote in quotelist + a(href='/quotes/'+quote) + li.quotes #{quote} diff --git a/views/quotes.jade b/views/quotes.jade index 35dc519..38c73e1 100644 --- a/views/quotes.jade +++ b/views/quotes.jade @@ -1,26 +1,29 @@ -div#backlink - a(href='/quotes/') « Quote list -ul#quotelist - -var hasYouTubeVids=false - -each quote in quotes - -if(quote.match(locals.url_regex)) - li.quote - -if(quote.match(/(jpg|png|gif|jpeg|tiff)$/)) - a(href=quote) - img(src=quote) - -else if(quote.match(/youtube.com\/watch/)) - -hasYouTubeVids = true - span(class='ytplaceholder') - =quote - -else - a(href=quote) - =quote - -else if(quote.match(/~~([^~]+)~~/)) - -var res = quote.match(/~~([^~]+)~~/) - -if(res != null) - li.quote - a(href="/quotes/#{res[1]}") #{quote} - -else - li.quote #{quote} - -if(hasYouTubeVids) - script(src='/ytembed.js') +extends layout + +block content + div#backlink + a(href='/quotes/') « Quote list + ul#quotelist + -var hasYouTubeVids=false + -each quote in quotes + -if(quote.match(locals.url_regex)) + li.quote + -if(quote.match(/(jpg|png|gif|jpeg|tiff)$/)) + a(href=quote) + img(src=quote) + -else if(quote.match(/youtube.com\/watch/)) + -hasYouTubeVids = true + span(class='ytplaceholder') + =quote + -else + a(href=quote) + =quote + -else if(quote.match(/~~([^~]+)~~/)) + -var res = quote.match(/~~([^~]+)~~/) + -if(res != null) + li.quote + a(href="/quotes/#{res[1]}") #{quote} + -else + li.quote #{quote} + -if(hasYouTubeVids) + script(src='/ytembed.js') diff --git a/views/user.jade b/views/user.jade index 5ba3828..8d1a680 100644 --- a/views/user.jade +++ b/views/user.jade @@ -1,11 +1,14 @@ -h3 #{user}'s profile -div#backlink - a(href='/users/'+connection+'/'+channel.substr(1,channel.length)) « #{channel} Nick List +extends layout -div.quotecount - #{cleanUser} is filled with - a(href='/quotes/'+cleanUser) #{quotecount} quotes - . +block content + h3 #{user}'s profile + div#backlink + a(href='/users/'+connection+'/'+channel.substr(1,channel.length)) « #{channel} Nick List -div.kickcount - #{cleanUser} has kicked people #{kicked} times and has been kicked #{kicks} times. + div.quotecount + #{cleanUser} is filled with + a(href='/quotes/'+cleanUser) #{quotecount} quotes + . + + div.kickcount + #{cleanUser} has kicked people #{kicked} times and has been kicked #{kicks} times. diff --git a/views/users.jade b/views/users.jade index 89c6a11..d043702 100644 --- a/views/users.jade +++ b/views/users.jade @@ -1,7 +1,10 @@ -h3 Users currently in #{channel} on #{connection} -div#backlink - a(href='/channels/'+connection) « Channel List -ul#quotelist - -each nick in nicks - a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick) - li.quotes #{nick} +extends layout + +block content + h3 Users currently in #{channel} on #{connection} + div#backlink + a(href='/channels/'+connection) « Channel List + ul#quotelist + -each nick in nicks + a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick) + li.quotes #{nick}