Skip to content

Commit ebfb9c6

Browse files
authored
IBX-10450: No tooltips for edit join icons on Draft conflict modal (#1709)
1 parent 1cc9228 commit ebfb9c6

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

src/bundle/Resources/public/js/scripts/helpers/tooltips.helper.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ const isTitleEllipsized = (node) => {
123123

124124
return textHeight > nodeHeight;
125125
};
126+
const getContainer = (tooltipNode) => {
127+
const { tooltipContainerSelector } = tooltipNode.dataset;
128+
const container = tooltipNode.closest(tooltipContainerSelector);
129+
130+
return container ?? doc.body;
131+
};
126132
const initializeTooltip = (tooltipNode, hasEllipsisStyle) => {
127133
const { delayShow, delayHide } = tooltipNode.dataset;
128134
const delay = {
@@ -134,9 +140,7 @@ const initializeTooltip = (tooltipNode, hasEllipsisStyle) => {
134140
const placement = tooltipNode.dataset.tooltipPlacement ?? 'bottom';
135141
const trigger = tooltipNode.dataset.tooltipTrigger ?? 'hover';
136142
const useHtml = tooltipNode.dataset.tooltipUseHtml !== undefined;
137-
const container = tooltipNode.dataset.tooltipContainerSelector
138-
? tooltipNode.closest(tooltipNode.dataset.tooltipContainerSelector)
139-
: 'body';
143+
const container = getContainer(tooltipNode);
140144
const iframe = document.querySelector(tooltipNode.dataset.tooltipIframeSelector);
141145

142146
new bootstrap.Tooltip(tooltipNode, {

src/lib/Menu/Action/VersionListActionMenuBuilder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ private function createEditDraftAction(
9999
bool $isDraftConflict = false
100100
): ItemInterface {
101101
$parameters['attributes']['class'] = self::IBEXA_BTN_CONTENT_DRAFT_EDIT_CLASS;
102+
$parameters['attributes']['data-tooltip-container-selector'] = '.ibexa-modal';
103+
102104
if ($isDraftConflict) {
103105
return $this->createDraftEditLinkAction($versionInfo, self::ITEM_EDIT_DRAFT, $parameters, $locationId);
104106
}

tests/lib/Menu/Action/BaseActionMenuBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected function assertActionItemSame(
9696
self::assertSame($url, $actionItem->getUri());
9797
self::assertSame($itemName, $actionItem->getLabel());
9898
self::assertSame($extras, $actionItem->getExtras());
99-
self::assertSame($attributes, $actionItem->getAttributes());
99+
self::assertEquals($attributes, $actionItem->getAttributes());
100100
}
101101

102102
protected function createVersionInfo(int $status = ApiVersionInfo::STATUS_DRAFT): ApiVersionInfo

tests/lib/Menu/Action/VersionListActionMenuBuilderTest.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ public function provideDataForTestBuildVersionListActionMenu(): iterable
104104
self::EDIT_ACTION_ITEM_EXTRAS,
105105
array_merge(
106106
self::EDIT_ACTION_ITEM_ATTRIBUTES,
107-
['data-content-draft-edit-url' => '/content/edit/draft/1/1/eng-GB']
107+
[
108+
'data-tooltip-container-selector' => '.ibexa-modal',
109+
'data-content-draft-edit-url' => '/content/edit/draft/1/1/eng-GB',
110+
]
108111
),
109112
];
110113

@@ -118,7 +121,10 @@ public function provideDataForTestBuildVersionListActionMenu(): iterable
118121
self::EDIT_ACTION_ITEM_EXTRAS,
119122
array_merge(
120123
self::EDIT_ACTION_ITEM_ATTRIBUTES,
121-
['data-content-draft-edit-url' => '/content/edit/draft/1/1/eng-GB/5']
124+
[
125+
'data-content-draft-edit-url' => '/content/edit/draft/1/1/eng-GB/5',
126+
'data-tooltip-container-selector' => '.ibexa-modal',
127+
]
122128
),
123129
];
124130

@@ -130,7 +136,10 @@ public function provideDataForTestBuildVersionListActionMenu(): iterable
130136
self::ITEM_EDIT_DRAFT,
131137
'/content/edit/draft/1/1/eng-GB',
132138
self::EDIT_ACTION_ITEM_EXTRAS,
133-
['class' => self::IBEXA_BTN_CONTENT_DRAFT_EDIT_CLASS],
139+
[
140+
'class' => self::IBEXA_BTN_CONTENT_DRAFT_EDIT_CLASS,
141+
'data-tooltip-container-selector' => '.ibexa-modal',
142+
],
134143
];
135144

136145
yield 'Restore version action item' => [
@@ -166,7 +175,10 @@ public function testAddUserUpdateItemAction(): void
166175
self::EDIT_ACTION_ITEM_EXTRAS,
167176
array_merge(
168177
self::EDIT_ACTION_ITEM_ATTRIBUTES,
169-
['data-content-draft-edit-url' => '/user/update/1/1/eng-GB']
178+
[
179+
'data-tooltip-container-selector' => '.ibexa-modal',
180+
'data-content-draft-edit-url' => '/user/update/1/1/eng-GB',
181+
]
170182
)
171183
);
172184
}

0 commit comments

Comments
 (0)