Add HTML template config, fixes to account profile page

This commit is contained in:
calzoneman 2014-01-25 13:55:00 -06:00
parent e70be5df42
commit 8313e7b006
5 changed files with 22 additions and 25 deletions

View File

@ -24,6 +24,11 @@ https:
passphrase: '' passphrase: ''
certfile: 'localhost.cert' certfile: 'localhost.cert'
# Page template values
html-template:
title: 'CyTube',
description: 'Free, open source synchtube'
# Socket.IO server details # Socket.IO server details
io: io:
port: 1337 port: 1337

View File

@ -57,6 +57,10 @@ var defaults = {
aliases: { aliases: {
"purge-interval": 3600000, "purge-interval": 3600000,
"max-age": 2592000000 "max-age": 2592000000
},
"html-template": {
title: "CyTube Beta",
description: "Free, open source synchtube"
} }
}; };

View File

@ -1,29 +1,21 @@
/** var jade = require("jade");
* web/jade.js - Provides functionality for rendering/serving jade templates var fs = require("fs");
* var path = require("path");
* @author Calvin Montgomery <cyzon@cyzon.us> var Config = require("../config");
*/ var templates = path.join(__dirname, "..", "..", "templates");
var jade = require('jade');
var fs = require('fs');
var path = require('path');
var templates = path.join(__dirname, '..', '..', 'templates');
var cache = {}; var cache = {};
/** /**
* Merges locals with globals for jade rendering * Merges locals with globals for jade rendering
*
* @param {Object} locals - The locals to merge
* @return {Object} an object containing globals and locals
*/ */
function merge(locals) { function merge(locals) {
var _locals = { var _locals = {
siteTitle: 'CyTube Beta', siteTitle: Config.get("html-template.title"),
siteDescription: 'Free, open source synchtube', siteDescription: Config.get("html-template.description"),
siteAuthor: 'Calvin "calzoneman" "cyzon" Montgomery' siteAuthor: "Calvin 'calzoneman' 'cyzon' Montgomery"
}; };
if (typeof locals !== 'object') { if (typeof locals !== "object") {
return _locals; return _locals;
} }
for (var key in locals) { for (var key in locals) {
@ -34,14 +26,10 @@ function merge(locals) {
/** /**
* Renders and serves a jade template * Renders and serves a jade template
*
* @param res - The HTTP response
* @param view - The view to render
* @param locals - The locals to pass to the renderer
*/ */
function sendJade(res, view, locals) { function sendJade(res, view, locals) {
if (!(view in cache) || process.env['DEBUG']) { if (!(view in cache) || process.env["DEBUG"]) {
var file = path.join(templates, view + '.jade'); var file = path.join(templates, view + ".jade");
var fn = jade.compile(fs.readFileSync(file), { var fn = jade.compile(fs.readFileSync(file), {
filename: file, filename: file,
pretty: true pretty: true

View File

@ -26,7 +26,7 @@ html(lang="en")
.alert.alert-danger.center.messagebox .alert.alert-danger.center.messagebox
strong Profile Error strong Profile Error
p= profileError p= profileError
.profile-box(style="position: inherit") .profile-box(style="position: inherit; z-index: auto;")
img.profile-image(src=profileImage) img.profile-image(src=profileImage)
strong= loginName strong= loginName
p= profileText p= profileText

View File

@ -29,7 +29,7 @@ mixin navdefaultlinks(page)
if loggedIn if loggedIn
li: a(href="/logout?redirect=#{page}") Logout li: a(href="/logout?redirect=#{page}") Logout
li.divider li.divider
li: a(href="/account/channels") My Channels li: a(href="/account/channels") Channels
li: a(href="/account/profile") Profile li: a(href="/account/profile") Profile
li: a(href="/account/edit") Change Password/Email li: a(href="/account/edit") Change Password/Email
else else