Commit 7a2fd029 authored by Benni Mack's avatar Benni Mack Committed by Christian Kuhn

[BUGFIX] Re-add proper badges for toolbar items

The opendocs toolbar item does not have a badge background anymore,
this changes re-adds the background and also unifies
the badge from the system information toolbar to use
the rounded-pill class.

Resolves: #93303
Releases: master
Change-Id: Ie2ecc99fd5ad4ad8845923af018c051665ac6118
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67459Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Riccardo De Contardi's avatarRiccardo De Contardi <erredeco@gmail.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 7608be0e
...@@ -47,7 +47,7 @@ class SystemInformationMenu { ...@@ -47,7 +47,7 @@ class SystemInformationMenu {
// ensure all default classes are available and previous // ensure all default classes are available and previous
// (at this time in processing unknown) class is removed // (at this time in processing unknown) class is removed
$counter.removeClass(); $counter.removeClass();
$counter.addClass('t3js-systeminformation-counter toolbar-item-badge badge'); $counter.addClass('t3js-systeminformation-counter toolbar-item-badge badge rounded-pill');
// badgeClass e.g. could be 'badge-info', 'badge-danger', ... // badgeClass e.g. could be 'badge-info', 'badge-danger', ...
if (badgeClass !== '') { if (badgeClass !== '') {
$counter.addClass(badgeClass); $counter.addClass(badgeClass);
......
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
title: 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:toolbarItems.sysinfo', title: 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:toolbarItems.sysinfo',
icon: '{core:icon(identifier: \'actions-system-list-open\', size: \'small\', alternativeMarkupIdentifier: \'inline\')}' icon: '{core:icon(identifier: \'actions-system-list-open\', size: \'small\', alternativeMarkupIdentifier: \'inline\')}'
}" /> }" />
<span class="toolbar-item-badge t3js-systeminformation-counter badge"></span> <span class="toolbar-item-badge t3js-systeminformation-counter badge rounded-pill bg-warning"></span>
</html> </html>
...@@ -10,4 +10,4 @@ ...@@ -10,4 +10,4 @@
* *
* The TYPO3 project - inspiring people to share! * The TYPO3 project - inspiring people to share!
*/ */
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","jquery","TYPO3/CMS/Core/Ajax/AjaxRequest","../Icons","../Storage/Persistent","../Viewport"],(function(e,t,o,n,r,a,s){"use strict";var i;o=__importDefault(o),function(e){e.containerSelector="#typo3-cms-backend-backend-toolbaritems-systeminformationtoolbaritem",e.toolbarIconSelector=".toolbar-item-icon .t3js-icon",e.menuContainerSelector=".dropdown-menu",e.moduleLinks=".t3js-systeminformation-module",e.counter=".t3js-systeminformation-counter"}(i||(i={}));class l{constructor(){this.timer=null,this.updateMenu=()=>{const e=o.default(i.toolbarIconSelector,i.containerSelector),t=e.clone(),a=o.default(i.containerSelector).find(i.menuContainerSelector);null!==this.timer&&(clearTimeout(this.timer),this.timer=null),r.getIcon("spinner-circle-light",r.sizes.small).then(t=>{e.replaceWith(t)}),new n(TYPO3.settings.ajaxUrls.systeminformation_render).get().then(async e=>{a.html(await e.resolve()),l.updateCounter(),o.default(i.moduleLinks).on("click",this.openModule)}).finally(()=>{o.default(i.toolbarIconSelector,i.containerSelector).replaceWith(t),this.timer=setTimeout(this.updateMenu,3e5)})},s.Topbar.Toolbar.registerEvent(this.updateMenu)}static updateCounter(){const e=o.default(i.containerSelector).find(i.menuContainerSelector).find(".t3js-systeminformation-container"),t=o.default(i.counter),n=e.data("count"),r=e.data("severityclass");t.text(n).toggle(parseInt(n,10)>0),t.removeClass(),t.addClass("t3js-systeminformation-counter toolbar-item-badge badge"),""!==r&&t.addClass(r)}openModule(e){e.preventDefault(),e.stopPropagation();let t={};const n={},r=o.default(e.currentTarget).data("modulename"),i=o.default(e.currentTarget).data("moduleparams"),l=Math.floor((new Date).getTime()/1e3);a.isset("systeminformation")&&(t=JSON.parse(a.get("systeminformation"))),n[r]={lastAccess:l},o.default.extend(!0,t,n);a.set("systeminformation",JSON.stringify(t)).done(()=>{TYPO3.ModuleMenu.App.showModule(r,i),s.Topbar.refresh()})}}return new l})); var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","jquery","TYPO3/CMS/Core/Ajax/AjaxRequest","../Icons","../Storage/Persistent","../Viewport"],(function(e,t,o,n,r,a,i){"use strict";var s;o=__importDefault(o),function(e){e.containerSelector="#typo3-cms-backend-backend-toolbaritems-systeminformationtoolbaritem",e.toolbarIconSelector=".toolbar-item-icon .t3js-icon",e.menuContainerSelector=".dropdown-menu",e.moduleLinks=".t3js-systeminformation-module",e.counter=".t3js-systeminformation-counter"}(s||(s={}));class l{constructor(){this.timer=null,this.updateMenu=()=>{const e=o.default(s.toolbarIconSelector,s.containerSelector),t=e.clone(),a=o.default(s.containerSelector).find(s.menuContainerSelector);null!==this.timer&&(clearTimeout(this.timer),this.timer=null),r.getIcon("spinner-circle-light",r.sizes.small).then(t=>{e.replaceWith(t)}),new n(TYPO3.settings.ajaxUrls.systeminformation_render).get().then(async e=>{a.html(await e.resolve()),l.updateCounter(),o.default(s.moduleLinks).on("click",this.openModule)}).finally(()=>{o.default(s.toolbarIconSelector,s.containerSelector).replaceWith(t),this.timer=setTimeout(this.updateMenu,3e5)})},i.Topbar.Toolbar.registerEvent(this.updateMenu)}static updateCounter(){const e=o.default(s.containerSelector).find(s.menuContainerSelector).find(".t3js-systeminformation-container"),t=o.default(s.counter),n=e.data("count"),r=e.data("severityclass");t.text(n).toggle(parseInt(n,10)>0),t.removeClass(),t.addClass("t3js-systeminformation-counter toolbar-item-badge badge rounded-pill"),""!==r&&t.addClass(r)}openModule(e){e.preventDefault(),e.stopPropagation();let t={};const n={},r=o.default(e.currentTarget).data("modulename"),s=o.default(e.currentTarget).data("moduleparams"),l=Math.floor((new Date).getTime()/1e3);a.isset("systeminformation")&&(t=JSON.parse(a.get("systeminformation"))),n[r]={lastAccess:l},o.default.extend(!0,t,n);a.set("systeminformation",JSON.stringify(t)).done(()=>{TYPO3.ModuleMenu.App.showModule(r,s),i.Topbar.refresh()})}}return new l}));
\ No newline at end of file \ No newline at end of file
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
<core:icon identifier="apps-toolbar-menu-opendocs" alternativeMarkupIdentifier="inline"/> <core:icon identifier="apps-toolbar-menu-opendocs" alternativeMarkupIdentifier="inline"/>
</span> </span>
<span class="toolbar-item-title">{f:translate(key: 'toolbaritem', extensionName: 'opendocs')}</span> <span class="toolbar-item-title">{f:translate(key: 'toolbaritem', extensionName: 'opendocs')}</span>
<span class="toolbar-item-badge badge" id="tx-opendocs-counter"></span> <span class="toolbar-item-badge badge rounded-pill bg-primary" id="tx-opendocs-counter"></span>
</html> </html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment