From b71e6d245876594de38e38abf57b7eb45d050034 Mon Sep 17 00:00:00 2001 From: LucasC Date: Fri, 24 Jan 2025 16:44:30 +0100 Subject: [PATCH] XWIKI-22814: Regression on the Dashboard buttons layout when there's a warning message (#3835) * Fixed the layout construction to make sure everything is fine if there's a warning box. * Removed typos (cherry picked from commit 023144daf732d04b085c2423ebd4552edd09ac5c) --- .../uicomponents/dashboard/dashboard.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/dashboard/dashboard.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/dashboard/dashboard.js index e951085fe6c9..310e3f0b86ea 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/dashboard/dashboard.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/uicomponents/dashboard/dashboard.js @@ -80,12 +80,18 @@ XWiki.Dashboard = Class.create( { // find out all the gadget-containers in element and add them ids this.containers = element.select(".gadget-container"); this.createDragAndDrops(); - this.addGadgetsHandlers();`` + this.addGadgetsHandlers(); // Create the section to contain add buttons var sectionAddButtons = new Element('section', { 'class': 'containeradd' - }) - this.element.insert({'top' : sectionAddButtons}); + }); + // check if the warning is there, if it is, put the button under it + var warning = this.element.down('.differentsource'); + if (warning) { + warning.insert({'after' : sectionAddButtons}); + } else { + this.element.insert({'top' : sectionAddButtons}); + } this.addNewGadgetHandler(); this.addNewContainerHandler(); @@ -295,13 +301,7 @@ XWiki.Dashboard = Class.create( { }); addButton.update(icons.add + l10n['dashboard.actions.add.button']); addButton.observe('click', this.onAddGadgetClick.bindAsEventListener(this)); - // check if the warning is there, if it is, put the button under it - var warning = this.element.down('.differentsource'); - if (warning) { - warning.insert({'after' : addButton}); - } else { - this.element.down('.containeradd').insert(addButton); - } + this.element.down('.containeradd').insert(addButton); }, /**