diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-05-11 08:22:51 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-06-16 17:12:56 +0200 |
commit | a94236483e26785dcaf97fb10e863f82348eb068 (patch) | |
tree | 72acc7ac8eb955e93704bf563cc2973149ab9f97 /core/src | |
parent | 4c93249514783181115be8bb040de701bffdba10 (diff) | |
download | nextcloud-server-a94236483e26785dcaf97fb10e863f82348eb068.tar.gz nextcloud-server-a94236483e26785dcaf97fb10e863f82348eb068.zip |
Let apps toggle an unread counter on app icons
Co-authored-by: Louis Chemineau <louis@chmn.me>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/components/MainMenu.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/src/components/MainMenu.js b/core/src/components/MainMenu.js index 74ca3de1c5e..3b5aa19245e 100644 --- a/core/src/components/MainMenu.js +++ b/core/src/components/MainMenu.js @@ -32,6 +32,26 @@ import OC from '../OC' * If the screen is bigger, the main menu is not a toggle any more. */ export const setUp = () => { + + Object.assign(OC, { + setNavigationCounter(id, counter) { + const appmenuElement = document.getElementById('appmenu').querySelector('[data-id="' + id + '"] svg') + const appsElement = document.getElementById('apps').querySelector('[data-id="' + id + '"] svg') + if (counter === 0) { + appmenuElement.classList.remove('has-unread') + appsElement.classList.remove('has-unread') + appmenuElement.getElementsByTagName('image')[0].style.mask = '' + appsElement.getElementsByTagName('image')[0].style.mask = '' + } else { + appmenuElement.classList.add('has-unread') + appsElement.classList.add('has-unread') + appmenuElement.getElementsByTagName('image')[0].style.mask = 'url(#hole)' + appsElement.getElementsByTagName('image')[0].style.mask = 'url(#hole)' + } + document.getElementById('appmenu').querySelector('[data-id="' + id + '"] .unread-counter').textContent = counter + document.getElementById('apps').querySelector('[data-id="' + id + '"] .unread-counter').textContent = counter + }, + }) // init the more-apps menu OC.registerMenu($('#more-apps > a'), $('#navigation')) |