refactored /popular to use same content list
This commit is contained in:
parent
b1dcb78a3d
commit
aa7f6d567c
5 changed files with 18 additions and 28 deletions
|
@ -155,7 +155,6 @@ module.exports = {
|
||||||
allChannelClaims.forEach(element => {
|
allChannelClaims.forEach(element => {
|
||||||
const fileExtenstion = element.contentType.substring(element.contentType.lastIndexOf('/') + 1);
|
const fileExtenstion = element.contentType.substring(element.contentType.lastIndexOf('/') + 1);
|
||||||
element['showUrlLong'] = `/${channelName}:${longChannelId}/${element.name}`;
|
element['showUrlLong'] = `/${channelName}:${longChannelId}/${element.name}`;
|
||||||
element['showUrlShort'] = `/${channelName}:${shortChannelId}/${element.name}`;
|
|
||||||
element['directUrlLong'] = `/${channelName}:${longChannelId}/${element.name}.${fileExtenstion}`;
|
element['directUrlLong'] = `/${channelName}:${longChannelId}/${element.name}.${fileExtenstion}`;
|
||||||
element['directUrlShort'] = `/${channelName}:${shortChannelId}/${element.name}.${fileExtenstion}`;
|
element['directUrlShort'] = `/${channelName}:${shortChannelId}/${element.name}.${fileExtenstion}`;
|
||||||
});
|
});
|
||||||
|
|
|
@ -148,6 +148,16 @@ module.exports = {
|
||||||
// get the raw requests data
|
// get the raw requests data
|
||||||
db.getTrendingClaims(startDate)
|
db.getTrendingClaims(startDate)
|
||||||
.then(results => {
|
.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);
|
resolve(results);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|
|
@ -132,7 +132,6 @@ module.exports = (app) => {
|
||||||
channelName,
|
channelName,
|
||||||
channelContents,
|
channelContents,
|
||||||
};
|
};
|
||||||
logger.debug(handlebarsData);
|
|
||||||
res.status(200).render('channel', handlebarsData);
|
res.status(200).render('channel', handlebarsData);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -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>
|
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
{{> topBar}}
|
{{> 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>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue