Added logo support

This commit is contained in:
Brian Peacock 2014-05-08 17:58:13 -05:00
parent 277f1023c9
commit a6fe4a1516
4 changed files with 46 additions and 18 deletions

View File

@ -18,14 +18,6 @@ a:hover {
text-decoration: underline;
}
h1 {
text-align: center;
a, a:visited {
color: black;
}
}
.center {
text-align: center;
}
@ -37,6 +29,7 @@ header {
width: 100%;
background: #FFF;
top: 0;
z-index: 1;
#header-inner {
max-width: @contentWidth + @headerPadding*2;
@ -50,6 +43,21 @@ header {
padding: 20px;
}
#logo {
margin: 20px auto;
width: 400px;
height: 200px;
display: block;
}
h1 {
text-align: center;
a, a:visited {
color: black;
}
}
/*** Setup ***/
#setup {
background: #DB4141;

View File

@ -9,7 +9,9 @@
<body>
<header>
<div id='header-inner'>
<h1><a href='/'>{{ name }}</a></h1>
{{#if logo}}
<a href='/'><img id='logo' alt='{{ name }}' title='{{ name }}' src='/-/logo' /></a>
{{/if}}
<div class='center'>
<article id='setup'>

View File

@ -137,7 +137,8 @@ module.exports = function(config_hash) {
res.send(template({
name: config.title || "Sinopia",
packages: packages,
baseUrl: config.root || req.protocol + '://' + req.get('host') + '/'
baseUrl: config.root || req.protocol + '://' + req.get('host') + '/',
logo: config.logo
}));
});
});
@ -242,6 +243,16 @@ module.exports = function(config_hash) {
});
});
app.get('/-/logo', function(req, res, next) {
if(config.logo) {
res.sendfile(config.logo);
}
else {
res.status(404);
res.send("File Not Found");
}
});
// Search
app.get('/-/search/:query', function(req, res, next) {
var results = search.query(req.params.query),

File diff suppressed because one or more lines are too long