Show View count on items

This commit is contained in:
Prateeksha Singh 2018-08-02 02:07:04 +05:30
parent 32a2148651
commit 106856b1ab

View File

@ -62,9 +62,17 @@ erpnext.hub.Item = class Item extends SubPage {
const description = item.description || ''; const description = item.description || '';
let stats = __('No views yet');
if(item.view_count) {
const views_message = __(`${item.view_count} Views`);
const rating_html = get_rating_html(item.average_rating); const rating_html = get_rating_html(item.average_rating);
const rating_count = item.no_of_ratings > 0 ? `${item.no_of_ratings} reviews` : __('No reviews yet'); const rating_count = item.no_of_ratings > 0 ? `${item.no_of_ratings} reviews` : __('No reviews yet');
stats = `${views_message}${dot_spacer}${rating_html} (${rating_count})`;
}
let menu_items = ''; let menu_items = '';
if(this.own_item) { if(this.own_item) {
@ -94,7 +102,7 @@ erpnext.hub.Item = class Item extends SubPage {
<h2>${title}</h2> <h2>${title}</h2>
<div class="text-muted"> <div class="text-muted">
<p>${where}${dot_spacer}${when}</p> <p>${where}${dot_spacer}${when}</p>
<p>${rating_html} (${rating_count})</p> <p>${stats}</p>
</div> </div>
<hr> <hr>
<div class="hub-item-description"> <div class="hub-item-description">