refactored /popular to use same content list

This commit is contained in:
bill bittner 2017-09-11 12:10:41 -07:00
parent b1dcb78a3d
commit aa7f6d567c
5 changed files with 18 additions and 28 deletions

View file

@ -155,7 +155,6 @@ module.exports = {
allChannelClaims.forEach(element => {
const fileExtenstion = element.contentType.substring(element.contentType.lastIndexOf('/') + 1);
element['showUrlLong'] = `/${channelName}:${longChannelId}/${element.name}`;
element['showUrlShort'] = `/${channelName}:${shortChannelId}/${element.name}`;
element['directUrlLong'] = `/${channelName}:${longChannelId}/${element.name}.${fileExtenstion}`;
element['directUrlShort'] = `/${channelName}:${shortChannelId}/${element.name}.${fileExtenstion}`;
});

View file

@ -148,6 +148,16 @@ module.exports = {
// get the raw requests data
db.getTrendingClaims(startDate)
.then(results => {
if (results) {
results.forEach(element => {
const fileExtenstion = element.fileType.substring(element.fileType.lastIndexOf('/') + 1);
element['showUrlLong'] = `/${element.claimId}/${element.name}`;
element['directUrlLong'] = `/${element.claimId}/${element.name}.${fileExtenstion}`;
element['directUrlShort'] = `/${element.claimId}/${element.name}.${fileExtenstion}`;
element['contentType'] = element.fileType;
element['thumbnail'] = '';
});
}
resolve(results);
})
.catch(error => {

View file

@ -132,7 +132,6 @@ module.exports = (app) => {
channelName,
channelContents,
};
logger.debug(handlebarsData);
res.status(200).render('channel', handlebarsData);
}
})

View file

@ -1,25 +0,0 @@
<div class="full">
<h2>Trending</h2>
<p><i>The 25 most popular assets on spee.ch</i></p>
<div class="grid" data-masonry='{ "itemSelector": ".grid-item" }'>
{{#each trendingAssets}}
<div class="all-claims-item">
<a href="/{{this.claimId}}/{{this.name}}">
{{#ifConditional this.fileType '===' 'video/mp4'}}
<img class="all-claims-asset" src="/assets/img/content-freedom-large.png"/>
{{else}}
<img class="all-claims-asset" src="/{{this.claimId}}/{{this.name}}.ext" />
{{/ifConditional}}
</a>
<div class="all-claims-details">
<ul style="list-style-type:none">
<li><bold>{{this.name}}</bold></li>
<li><i>Claim Id: {{this.claimId}}</i></li>
<li><strong>{{this.title}}</strong></li>
</ul>
</div>
</div>
{{/each}}
</div>
</div>

View file

@ -1,4 +1,11 @@
<div class="wrapper">
{{> topBar}}
{{> trendingAssets}}
<div>
<h3>Popular</h3>
<p>Below are the 25 most popular items on spee.ch</p>
{{#each trendingAssets}}
{{> contentListItem}}
{{/each}}
</div>
{{> footer}}
</div>