From bca120a3ee79c1111d9374e28ad878991ae3d345 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 13 Dec 2018 15:07:18 +0100 Subject: [PATCH] Display the correct available apps on the home page --- customize.dist/pages/index.js | 33 +++++++++++-------- .../src/less2/pages/page-index.less | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/customize.dist/pages/index.js b/customize.dist/pages/index.js index 5af40deec..ee3c7fa46 100644 --- a/customize.dist/pages/index.js +++ b/customize.dist/pages/index.js @@ -11,35 +11,40 @@ define([ var isAvailableType = function (x) { if (!Array.isArray(AppConfig.availablePadTypes)) { return true; } - return AppConfig.availablePadTypes.some(function (type) { - return x.indexOf(type) > -1; - }); + return AppConfig.availablePadTypes.indexOf(x) !== -1; + }; + + var checkRegisteredType = function (x) { + // Return true if we're registered or if the app is not registeredOnly + if (LocalStore.isLoggedIn()) { return true; } + if (!Array.isArray(AppConfig.registeredOnlyTypes)) { return true; } + return AppConfig.registeredOnlyTypes.indexOf(x) === -1; }; return function () { var showingMore = false; var icons = [ - [ 'pad', '/pad/', Msg.main_richTextPad, 'pad' ], - [ 'code', '/code/', Msg.main_codePad, 'code' ], - [ 'slide', '/slide/', Msg.main_slidePad, 'slide' ], - [ 'poll', '/poll/', Msg.main_pollPad, 'poll' ], - [ 'kanban', '/kanban/', Msg.main_kanbanPad, 'kanban' ], - [ 'whiteboard', '/whiteboard/', Msg.main_whiteboardPad, 'whiteboard' ], - [ 'recent', '/drive/', LocalStore.isLoggedIn() ? Msg.main_yourCryptDrive : Msg.main_localPads, 'drive' ] + [ 'pad', Msg.main_richTextPad], + [ 'code', Msg.main_codePad], + [ 'slide', Msg.main_slidePad], + [ 'poll', Msg.main_pollPad], + [ 'kanban', Msg.main_kanbanPad], + [ 'whiteboard', Msg.main_whiteboardPad], + [ 'drive', LocalStore.isLoggedIn() ? Msg.main_yourCryptDrive : Msg.main_localPads] ].filter(function (x) { - return isAvailableType(x[1]); + return isAvailableType(x[0]) && checkRegisteredType(x[0]); }) .map(function (x, i) { var s = 'div.bs-callout.cp-callout-' + x[0]; if (i > 2) { s += '.cp-more.cp-hidden'; } - var icon = AppConfig.applicationsIcon[x[3]]; + var icon = AppConfig.applicationsIcon[x[0]]; var font = icon.indexOf('cptools') === 0 ? 'cptools' : 'fa'; return h('a', [ - { href: x[1] }, + { href: '/'+ x[0] +'/' }, h(s, [ h('i.' + font + '.' + icon), - h('div.pad-button-text', [ h('h4', x[2]) ]) + h('div.pad-button-text', [ h('h4', x[1]) ]) ]) ]); }); diff --git a/customize.dist/src/less2/pages/page-index.less b/customize.dist/src/less2/pages/page-index.less index 8c364a04d..662a0e0fe 100644 --- a/customize.dist/src/less2/pages/page-index.less +++ b/customize.dist/src/less2/pages/page-index.less @@ -166,7 +166,7 @@ .cp-callout-poll .cptools { background-color: @colortheme_poll-bg; } .cp-callout-kanban .cptools { background-color: @colortheme_kanban-bg; } .cp-callout-whiteboard .cptools { background-color: @colortheme_whiteboard-bg; } - .cp-callout-recent .fa { background-color: @colortheme_drive-bg; } + .cp-callout-drive .fa { background-color: @colortheme_drive-bg; } .cp-hidden { display: none !important; } .cp-callout-more { display: inline-block;