From 106856b1ab8ea2d596acf14b9df2611d67f60218 Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Thu, 2 Aug 2018 02:07:04 +0530 Subject: [PATCH] Show View count on items --- erpnext/public/js/hub/pages/item.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/erpnext/public/js/hub/pages/item.js b/erpnext/public/js/hub/pages/item.js index 609479b0ef..7efa21fcb4 100644 --- a/erpnext/public/js/hub/pages/item.js +++ b/erpnext/public/js/hub/pages/item.js @@ -62,8 +62,16 @@ erpnext.hub.Item = class Item extends SubPage { const description = item.description || ''; - 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'); + 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_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 = ''; @@ -94,7 +102,7 @@ erpnext.hub.Item = class Item extends SubPage {

${title}

${where}${dot_spacer}${when}

-

${rating_html} (${rating_count})

+

${stats}