Render share page before all matches are found.

This commit is contained in:
Jonathan Cremin 2014-12-13 15:56:52 +00:00
parent 6f3e8b06a6
commit 4bfdf0dc45
7 changed files with 81 additions and 64 deletions

View file

@ -12,19 +12,19 @@
<div class="row">
<div class="col-md-9 col-sm-8 col-xs-12">
<h3>Matched albums for</h3>
<h2><%= items[0].name %> <span class="artist-lighten">- <%= items[0].artist.name %></span></h2>
<h2><%= matching.name %> <span class="artist-lighten">- <%= matching.artist.name %></span></h2>
</div>
<div class="col-md-3 col-sm-4 hidden-xs">
<ul class="list-inline share-tools">
<li>Share this</li>
<li><a href="http://twitter.com/intent/tweet/?text=Check out <%= items[0].name + " by " + items[0].artist.name %>&url=<%= thisUrl %>&via=MatchAudio" class="share-dialog"><img src="/images/twitter.png" alt="Twitter" /></a></li>
<li><a href="http://twitter.com/intent/tweet/?text=Check out <%= matching.name + " by " + matching.artist.name %>&url=<%= thisUrl %>&via=MatchAudio" class="share-dialog"><img src="/images/twitter.png" alt="Twitter" /></a></li>
<li><a href="http://www.facebook.com/sharer/sharer.php?p[url]=<%= thisUrl %>" class="share-dialog"><img src="/images/facebook.png" alt="Facebook" /></a></li>
<li><a href="https://plus.google.com/share?url=<%= thisUrl %>" class="share-dialog"><img src="/images/googleplus.png" alt="Google+" /></a></li>
</ul>
</div>
</div>
<div class="row">
<% for (var i=0;i < items.length;i++) { var album = items[i]; %>
<% for (var i=0;i < matches.length;i++) { var album = matches[i]; %>
<% if (album.type != "video") { %><div class="col-md-3 col-xs-6"><% } else { %><div class="col-md-6 col-xs-12"><% } %>
<div class="service <%= i==0 ? "source-service" : "" %>">
<div class="matching-from hidden-xs"><%= i==0 ? "Found matches using this link" : "" %></div>
@ -32,7 +32,7 @@
<div class="js-video widescreen">
<iframe width="100%" src="//www.youtube.com/embed/<%= album.id %>" frameborder="0" allowfullscreen></iframe>
</div>
<a href="https://www.youtube.com/results?search_query=<%= items[0].name %> <%= items[0].artist.name %>">More Youtube matches</a>
<a href="https://www.youtube.com/results?search_query=<%= matching.name %> <%= matching.artist.name %>">More Youtube matches</a>
<% } else if (album.streamUrl) { %>
<a href="<%= album.streamUrl %>"><img src="<%= album.artwork.small %>" class="img-rounded album-artwork" width="100%"></a>
<div class="service-link">
@ -44,7 +44,7 @@
<a href="<%= album.purchaseUrl %>"><img src="/images/<%= album.service %>.png" class="img-rounded"></a>
</div>
<% } else { %>
<img src="<%= items[0].artwork.small %>" class="img-rounded album-artwork not-found" width="100%"></a>
<img src="<%= matching.artwork.small %>" class="img-rounded album-artwork not-found" width="100%"></a>
<div class="service-link">
<img src="/images/<%= album.service %>.png" class="img-rounded not-found">
</div>
@ -57,7 +57,7 @@
<div class="col-md-12">
<ul class="list-inline share-tools">
<li>Share this</li>
<li><a href="http://twitter.com/intent/tweet/?text=Check out <%= items[0].name + " by " + items[0].artist.name %>&url=<%= thisUrl %>&via=MatchAudio" class="share-dialog"><img src="/images/twitter.png" alt="Twitter" /></a></li>
<li><a href="http://twitter.com/intent/tweet/?text=Check out <%= matching.name + " by " + matching.artist.name %>&url=<%= thisUrl %>&via=MatchAudio" class="share-dialog"><img src="/images/twitter.png" alt="Twitter" /></a></li>
<li><a href="http://www.facebook.com/sharer/sharer.php?p[url]=<%= thisUrl %>" class="share-dialog"><img src="/images/facebook.png" alt="Facebook" /></a></li>
<li><a href="https://plus.google.com/share?url=<%= thisUrl %>" class="share-dialog"><img src="/images/googleplus.png" alt="Google+" /></a></li>
</ul>

View file

@ -31,7 +31,7 @@
<div class="col-md-6 col-md-offset-3">
<% if (recent.length) { %><h2>Recently Shared</h2><% } %>
<div class="row recent">
<% for (var i=0;i < recent.length;i++) { var item = recent[i].items[0]; %>
<% for (var i=0;i < recent.length;i++) { var item = recent[i].services[recent[i]._id.split('$$')[0]]; %>
<div class="col-sm-4 col-xs-6">
<a href="/<%= item.service.replace("playmusic", "") %>/<%= item.type %>/<%= item.id %>"><img src="<%= item.artwork.small ? item.artwork.small : item.artwork %>" width="100%"></a>
</div>