-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
65 additions
and
50 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import DOMReady from "../../utils/DOMReady"; | ||
import $ from "jquery"; | ||
Check failure on line 2 in _dev/js/theme/components/customer/index.js GitHub Actions / Code quality - ESLint
Check failure on line 2 in _dev/js/theme/components/customer/index.js GitHub Actions / Code quality - ESLint
|
||
|
||
const initCustomerLinksTriggerActive = () => { | ||
const url = window.location.pathname; | ||
const customerLinks = document.querySelectorAll('.js-customer-links a'); | ||
|
||
customerLinks.forEach((el) => { | ||
if (el.getAttribute('href').indexOf(url) !== -1) { | ||
el.classList.add('active'); | ||
} | ||
}); | ||
} | ||
|
||
const initRmaForm = () => { | ||
const returnForm = document.querySelector(prestashop.selectors.order.returnForm); | ||
|
||
if (!returnForm) { | ||
return; | ||
} | ||
|
||
returnForm.querySelector('thead input[type=checkbox]').addEventListener('click', ({ currentTarget }) => { | ||
const checked = currentTarget.checked; | ||
returnForm.querySelectorAll('tbody input[type=checkbox]').forEach((checkbox) => { | ||
checkbox.checked = checked; | ||
}); | ||
}); | ||
} | ||
|
||
|
||
DOMReady(() => { | ||
initCustomerLinksTriggerActive(); | ||
initRmaForm(); | ||
}) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import DOMReady from "../../utils/DOMReady"; | ||
import useTopMenu from './useTopMenu'; | ||
import useStickyElement from "../useStickyElement"; | ||
|
||
const initStickyHeader = () => { | ||
const header = document.querySelector('.js-header-top'); | ||
const headerWrapper = document.querySelector('.js-header-top-wrapper'); | ||
|
||
if (header && headerWrapper) { | ||
const { init } = useStickyElement(header, headerWrapper); | ||
|
||
init(); | ||
} | ||
} | ||
|
||
DOMReady(() => { | ||
const { init: initTopMenu } = useTopMenu('.js-main-menu'); | ||
|
||
initTopMenu(); | ||
initStickyHeader(); | ||
}); |
2 changes: 1 addition & 1 deletion
2
_dev/js/theme/components/useTopMenu.js → .../js/theme/components/header/useTopMenu.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters