diff --git a/src/components/homesections/homesections.js b/src/components/homesections/homesections.js index af574200f3..c6d0652ecc 100644 --- a/src/components/homesections/homesections.js +++ b/src/components/homesections/homesections.js @@ -40,26 +40,48 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la return getUserViews(apiClient, user.Id).then(function (userViews) { var html = ''; - var sectionCount = 7; - for (var i = 0; i < sectionCount; i++) { - html += '
'; - } + if (userViews.length) { + var sectionCount = 7; + for (var i = 0; i < sectionCount; i++) { + html += ''; + } - elem.innerHTML = html; - elem.classList.add('homeSectionsContainer'); + elem.innerHTML = html; + elem.classList.add('homeSectionsContainer'); - var promises = []; - var sections = getAllSectionsToShow(userSettings, sectionCount); - for (var i = 0; i < sections.length; i++) { - promises.push(loadSection(elem, apiClient, user, userSettings, userViews, sections, i)); - } + var promises = []; + var sections = getAllSectionsToShow(userSettings, sectionCount); + for (var i = 0; i < sections.length; i++) { + promises.push(loadSection(elem, apiClient, user, userSettings, userViews, sections, i)); + } - return Promise.all(promises).then(function () { - return resume(elem, { - refresh: true, - returnPromise: false + return Promise.all(promises).then(function () { + return resume(elem, { + refresh: true, + returnPromise: false + }); }); - }); + } else { + var noLibDescription; + if (user['Policy'] && user['Policy']['IsAdministrator']) { + noLibDescription = Globalize.translate("NoCreatedLibraries", '', '') + } else { + noLibDescription = Globalize.translate("AskAdminToCreateLibrary"); + } + + html += '' + noLibDescription + '
' + html += '