Skip to content

Commit 349a81f

Browse files
committed
review fixes pt 6
1 parent 88c29a3 commit 349a81f

File tree

3 files changed

+32
-9
lines changed

3 files changed

+32
-9
lines changed

src/bundle/Resources/config/bazinga_js_translation.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ active_domains:
1212
- 'ibexa_user_invitation'
1313
- 'ibexa_content_type'
1414
- 'ibexa_dropdown'
15+
- 'ibexa_collapse'
1516
- 'messages'

src/bundle/Resources/public/js/scripts/core/collapse.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
(function (global, doc, bootstrap, Translator) {
22
let toggleAllTimeout;
3+
const TOGGLE_TIMEOUT = 200;
34
const toggleAllBtns = [...doc.querySelectorAll(`[data-multi-collapse-btn-id]`)];
45
const toggleMultiCollapseBtn = (btn, changeToCollapseAll) => {
56
const displayedText = changeToCollapseAll
6-
? /*@Desc("Collapse all)*/ 'product_type.edit.section.attribute_collapse_all'
7-
: /*@Desc("Expand all)*/ 'product_type.edit.section.attribute_expand_all';
7+
? /*@Desc("Collapse all sections)*/ 'collapse.collapse_all'
8+
: /*@Desc("Expand all sections)*/ 'collapse.expand_all';
89

9-
btn.innerText = Translator.trans(displayedText, {}, 'ibexa_product_catalog');
10+
btn.innerText = Translator.trans(displayedText, {}, 'ibexa_collapse');
1011
btn.classList.toggle('ibexa-multi-collapse__btn--expand-all-label', !changeToCollapseAll);
1112
};
1213

@@ -42,16 +43,16 @@
4243
section.addEventListener('click', () => {
4344
const currentCollapsibleBtns = [...multiCollapseNode.querySelectorAll('[data-bs-toggle]')];
4445

45-
window.clearTimeout(toggleAllTimeout);
46+
global.clearTimeout(toggleAllTimeout);
4647

47-
toggleAllTimeout = window.setTimeout(() => {
48+
toggleAllTimeout = global.setTimeout(() => {
4849
const collapsedCount = currentCollapsibleBtns.filter((btn) => btn.classList.contains('collapsed')).length;
4950
const shouldBeToggled = collapsedCount === currentCollapsibleBtns.length || collapsedCount === 0;
5051

5152
if (shouldBeToggled) {
5253
toggleMultiCollapseBtn(currentToggleAllBtn, collapsedCount === 0);
5354
}
54-
}, 200);
55+
}, TOGGLE_TIMEOUT);
5556
});
5657
};
5758

@@ -83,14 +84,14 @@
8384

8485
const multiCollapseBodyNode = doc.querySelector(`[data-multi-collapse-body="${collapseId}"]`);
8586

86-
window.clearTimeout(toggleAllTimeout);
87+
global.clearTimeout(toggleAllTimeout);
8788

88-
toggleAllTimeout = window.setTimeout(() => {
89+
toggleAllTimeout = global.setTimeout(() => {
8990
const isExpandingAction = btn.classList.contains('ibexa-multi-collapse__btn--expand-all-label');
9091

9192
handleCollapseAction(multiCollapseBodyNode, isExpandingAction);
9293
toggleMultiCollapseBtn(btn, isExpandingAction);
93-
}, 200);
94+
}, TOGGLE_TIMEOUT);
9495
});
9596
};
9697
toggleAllBtns.forEach(attachAllElementsToggler);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
3+
<file source-language="en" target-language="en" datatype="plaintext" original="not.available">
4+
<header>
5+
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
6+
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
7+
</header>
8+
<body>
9+
<trans-unit id="4436e5415672ea41ee48dbda15f8cb25baae6c64" resname="collapse.collapse_all">
10+
<source>Collapse all sections</source>
11+
<target state="new">Collapse all sections</target>
12+
<note>key: collapse.collapse_all</note>
13+
</trans-unit>
14+
<trans-unit id="5f80091b211b46190856ec877c535d63aee17627" resname="collapse.expand_all">
15+
<source>Expand all sections</source>
16+
<target state="new">Expand all sections</target>
17+
<note>key: collapse.expand_all</note>
18+
</trans-unit>
19+
</body>
20+
</file>
21+
</xliff>

0 commit comments

Comments
 (0)