Refactor templates, refresh design a bit

This commit is contained in:
Jonathan Cremin 2014-12-05 12:49:07 +00:00
parent 46ab5fe748
commit 8edd4a4179
9 changed files with 77 additions and 70 deletions

View file

@ -19,6 +19,6 @@ This is in super early development and is incapable of handling getting dugg, ne
On the immediate todo list: On the immediate todo list:
* Use album release year for additional sanity check on matches * Use album release year for additional sanity check on matches
* Maybe drop everything from the first special character in album names to improve matches **after** failing to get a good match * Maybe drop everything from the first left-hand bracket in album names to improve matches **after** failing to get a good match
* Handle expected and unexpected errors better than the current crash-fest * Handle expected and unexpected errors better than the current crash-fest
* Add some kind of persistence or caching so it could take a pummeling and not get me banned from the various services * Add some kind of persistence or caching so it could take a pummeling and not get me banned from the various services

4
app.js
View file

@ -45,11 +45,11 @@ app.get('*', function(req,res,next) {
app.get('/', function(req, res) { app.get('/', function(req, res) {
var samples = [ var samples = [
{artist: "Aesop Rock", album: "None Shall Pass", url: '/google/album/Bpnz47tzvmp3p46ht3syerwyvva'}, {artist: "Aesop Rock", album: "Skelethon", url: '/google/album/B3ppmqcekrmxln4bre33om3qife'},
{artist: "Hozier", album: "self-titled album", url: '/google/album/Bd3mxcy3otokg4yc45qktq7l35q'}, {artist: "Hozier", album: "self-titled album", url: '/google/album/Bd3mxcy3otokg4yc45qktq7l35q'},
{artist: "Daft Punk", album: "Discovery", url: '/google/album/B4t6yqqvhnb2hy4st4uisjrcsrm'} {artist: "Daft Punk", album: "Discovery", url: '/google/album/B4t6yqqvhnb2hy4st4uisjrcsrm'}
]; ];
res.render('index', { samples: samples, error: req.flash('search-error') }); res.render('index', { page: "home", samples: samples, error: req.flash('search-error') });
}); });
app.post('/search', search); app.post('/search', search);

View file

@ -1,9 +1,10 @@
body { body {
font-family: "Open Sans"; font-family: "Open Sans";
color: #445470;
} }
header { header {
background: #e6832e; background: #FE4365;
} }
header h1 { header h1 {
@ -18,25 +19,50 @@ header h1 a {
color: #fff; color: #fff;
} }
a {
color: #C04969;
}
a:hover {
color: #824F6D;
}
header h1 a:hover, header h1 a:focus{ header h1 a:hover, header h1 a:focus{
color: #f2c4ad; color: #ffacc5;
text-decoration: none; text-decoration: none;
} }
.share header h1 { .home input[type="text"]:focus {
border-color: rgba(255, 68, 109, 0.8);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 5px rgba(255, 68, 109, 0.8);
outline: 0 none;
}
.album header h1, .track header h1 {
text-align: left; text-align: left;
font-size: 1.5em; font-size: 1.5em;
padding: 10px 0; padding: 10px 0;
} }
.audio-lighten { .audio-lighten {
color:#f2c4ad; color: #ffacc5;
}
.artist-lighten {
color: #8396b0;
font-weight: 300;
} }
h2 { h2 {
font-size: 1.5em; font-size: 1.8em;
font-weight: 700; font-weight: 700;
margin: 40px 0; margin-bottom: 40px;
}
h3 {
font-size: 1.5em;
color: #8396b0;
font-weight: 300;
} }
.share-form { .share-form {
@ -46,7 +72,7 @@ h2 {
} }
.btn-custom { .btn-custom {
background-color: #e6832e; background-color: #FE4365;
color: #fff; color: #fff;
} }

View file

@ -21,7 +21,7 @@ module.exports = function(req, res) {
var promises = []; var promises = [];
if (cache[serviceId][type + "-" + itemId]) { if (cache[serviceId][type + "-" + itemId]) {
res.render(type, {items: cache[serviceId][type + "-" + itemId]}); res.render(type, {page: type, items: cache[serviceId][type + "-" + itemId]});
return; return;
} }
@ -46,8 +46,8 @@ module.exports = function(req, res) {
}); });
items.unshift(item); items.unshift(item);
cache[serviceId][item.type + "-" + item.id] = items; cache[serviceId][type + "-" + itemId] = items;
res.render(type, {items: items}); res.render(type, {page: type, items: items});
}); });
}); });
}; };

View file

@ -1,17 +1,4 @@
<!doctype html> <% include header.ejs %>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Match Audio</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="/stylesheets/style.css">
</head>
<body class="album share">
<header> <header>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
@ -24,14 +11,15 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h2><%= items[0].artist.name %> - <%= items[0].name %></h2> <h3>Matched albums for</h3>
<h2><%= items[0].name %> <span class="artist-lighten">- <%= items[0].artist.name %></span></h2>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<% for (var i=0;i < items.length;i++) { var album = items[i]; %> <% for (var i=0;i < items.length;i++) { var album = items[i]; %>
<div class="col-md-3 col-xs-6"> <div class="col-md-3 col-xs-6">
<div class="service <%= i==0 ? "source-service" : "" %>"> <div class="service <%= i==0 ? "source-service" : "" %>">
<div class="matching-from"><%= i==0 ? "Found matches for this link" : "" %></div> <div class="matching-from"><%= i==0 ? "Found matches using this link" : "" %></div>
<% if (album.streamUrl) { %> <% if (album.streamUrl) { %>
<a href="<%= album.streamUrl %>"><img src="<%= album.artwork %>" class="img-rounded album-artwork" width="100%"></a> <a href="<%= album.streamUrl %>"><img src="<%= album.artwork %>" class="img-rounded album-artwork" width="100%"></a>
<div class="service-link"> <div class="service-link">
@ -42,7 +30,7 @@
<div class="service-link"> <div class="service-link">
<a href="<%= album.purchaseUrl %>"><img src="/images/<%= album.service %>.png" class="img-rounded"></a> <a href="<%= album.purchaseUrl %>"><img src="/images/<%= album.service %>.png" class="img-rounded"></a>
</div> </div>
<% }else { %> <% } else { %>
<img src="<%= items[0].artwork %>" class="img-rounded album-artwork not-found" width="100%"></a> <img src="<%= items[0].artwork %>" class="img-rounded album-artwork not-found" width="100%"></a>
<div class="service-link"> <div class="service-link">
<img src="/images/<%= album.service %>.png" class="img-rounded not-found"> <img src="/images/<%= album.service %>.png" class="img-rounded not-found">
@ -56,14 +44,4 @@
</div> </div>
</div> </div>
<script> <% include footer.ejs %>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66209-8', 'match.audio');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
</body>
</html>

11
views/footer.ejs Normal file
View file

@ -0,0 +1,11 @@
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66209-8', 'match.audio');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
</body>
</html>

14
views/header.ejs Normal file
View file

@ -0,0 +1,14 @@
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Match Audio</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="/stylesheets/style.css">
</head>
<body class="<%= page %>">

View file

@ -1,17 +1,4 @@
<!doctype html> <% include header.ejs %>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Match Audio</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="/stylesheets/style.css">
</head>
<body class="home">
<header> <header>
<h1><a href="/">match<span class="audio-lighten">.audio</span></a></h1> <h1><a href="/">match<span class="audio-lighten">.audio</span></a></h1>
</header> </header>
@ -43,14 +30,4 @@
</div> </div>
</div> </div>
</div> </div>
<script> <% include footer.ejs %>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66209-8', 'match.audio');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
</body>
</html>

View file

@ -24,14 +24,15 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h2><%= items[0].artist.name %> - <%= items[0].name %></h2> <h3>Matched tracks for</h3>
<h2><%= items[0].name %> <span class="artist-lighten">- <%= items[0].artist.name %></span></h2>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<% for (var i=0;i < items.length;i++) { var track = items[i]; %> <% for (var i=0;i < items.length;i++) { var track = items[i]; %>
<div class="col-md-3 col-xs-6"> <div class="col-md-3 col-xs-6">
<div class="service <%= i==0 ? "source-service" : "" %>"> <div class="service <%= i==0 ? "source-service" : "" %>">
<div class="matching-from"><%= i==0 ? "Found matches for this link" : "" %></div> <div class="matching-from"><%= i==0 ? "Found matches using this link" : "" %></div>
<% if (track.streamUrl) { %> <% if (track.streamUrl) { %>
<a href="<%= track.streamUrl %>"><img src="<%= track.artwork %>" class="img-rounded album-artwork" width="100%"></a> <a href="<%= track.streamUrl %>"><img src="<%= track.artwork %>" class="img-rounded album-artwork" width="100%"></a>
<div class="service-link"> <div class="service-link">
@ -42,7 +43,7 @@
<div class="service-link"> <div class="service-link">
<a href="<%= track.purchaseUrl %>"><img src="/images/<%= track.service %>.png" class="img-rounded"></a> <a href="<%= track.purchaseUrl %>"><img src="/images/<%= track.service %>.png" class="img-rounded"></a>
</div> </div>
<% }else { %> <% } else { %>
<img src="<%= items[0].artwork %>" class="img-rounded album-artwork not-found" width="100%"></a> <img src="<%= items[0].artwork %>" class="img-rounded album-artwork not-found" width="100%"></a>
<div class="service-link"> <div class="service-link">
<img src="/images/<%= track.service %>.png" class="img-rounded not-found"> <img src="/images/<%= track.service %>.png" class="img-rounded not-found">