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: ''
certfile: 'localhost.cert'
# Page template values
html-template:
title: 'CyTube',
description: 'Free, open source synchtube'
# Socket.IO server details
io:
port: 1337

View file

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

View file

@ -1,29 +1,21 @@
/**
* web/jade.js - Provides functionality for rendering/serving jade templates
*
* @author Calvin Montgomery <cyzon@cyzon.us>
*/
var jade = require('jade');
var fs = require('fs');
var path = require('path');
var templates = path.join(__dirname, '..', '..', 'templates');
var jade = require("jade");
var fs = require("fs");
var path = require("path");
var Config = require("../config");
var templates = path.join(__dirname, "..", "..", "templates");
var cache = {};
/**
* 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) {
var _locals = {
siteTitle: 'CyTube Beta',
siteDescription: 'Free, open source synchtube',
siteAuthor: 'Calvin "calzoneman" "cyzon" Montgomery'
siteTitle: Config.get("html-template.title"),
siteDescription: Config.get("html-template.description"),
siteAuthor: "Calvin 'calzoneman' 'cyzon' Montgomery"
};
if (typeof locals !== 'object') {
if (typeof locals !== "object") {
return _locals;
}
for (var key in locals) {
@ -34,14 +26,10 @@ function merge(locals) {
/**
* 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) {
if (!(view in cache) || process.env['DEBUG']) {
var file = path.join(templates, view + '.jade');
if (!(view in cache) || process.env["DEBUG"]) {
var file = path.join(templates, view + ".jade");
var fn = jade.compile(fs.readFileSync(file), {
filename: file,
pretty: true

View file

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

View file

@ -29,7 +29,7 @@ mixin navdefaultlinks(page)
if loggedIn
li: a(href="/logout?redirect=#{page}") Logout
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/edit") Change Password/Email
else