-
Notifications
You must be signed in to change notification settings - Fork 18
IBX-6250: Redesign PB Config panel #880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
95727e0
temp
GrabowskiM a8e25a7
redone JSes and CSSes
GrabowskiM b8175fe
redone switcher
GrabowskiM dfc29c1
IBX-6250: Redesign Config panel
GrabowskiM b85f85c
linter
GrabowskiM 8c33ae0
added errors icon to more
GrabowskiM 6ff915f
add fixed tests from ad6fff53e35ae5 commit
GrabowskiM 2150de9
fixes after cr
GrabowskiM 38b3983
added info radio
dew326 ec69a4f
added blue/info widgets
GrabowskiM 23190f3
use css vars
GrabowskiM 480addb
fixes to top border when no switcher
GrabowskiM c92b4e8
Adjusted behat tests
6685fb3
Adjuested behat tests part2
ba0d4e2
Adjust behat tests part3
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
74 changes: 74 additions & 0 deletions
74
src/bundle/Resources/public/js/scripts/admin.form.tabs.validation.js
This file contains hidden or 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,74 @@ | ||
| (function (global, doc) { | ||
| const tabsHeaders = doc.querySelectorAll('.ibexa-tabs[data-form-selector]'); | ||
| const getHrefFromGroup = (group) => { | ||
| if (group.dataset.id) { | ||
| return group.dataset.id; | ||
| } | ||
|
|
||
| return `#${group.id}`; | ||
| }; | ||
|
|
||
| tabsHeaders.forEach((tabsHeader) => { | ||
| const popupMenu = tabsHeader.querySelector('.ibexa-tabs__popup-menu'); | ||
| const moreBtn = tabsHeader.querySelector('.ibexa-tabs__tab--more'); | ||
| const { formSelector, formTabGroupSelector } = tabsHeader.dataset; | ||
| const formNode = doc.querySelector(formSelector); | ||
| const classInvalidChangedCallback = (mutationList) => { | ||
| mutationList.forEach((mutation) => { | ||
| const { oldValue, target } = mutation; | ||
| const hadIsInvalidClass = oldValue?.includes('is-invalid') ?? false; | ||
| const hasIsInvalidClass = target.classList.contains('is-invalid'); | ||
|
|
||
| if (hadIsInvalidClass !== hasIsInvalidClass) { | ||
| const sectionGroup = target.closest(formTabGroupSelector); | ||
|
|
||
| if (!sectionGroup) { | ||
| return; | ||
| } | ||
|
|
||
| const href = getHrefFromGroup(sectionGroup); | ||
| const hasGroupError = !!sectionGroup.querySelector('.is-invalid'); | ||
| const correspondingMenuItemLink = doc.querySelector(`.ibexa-tabs__tab [href="${href}"]`); | ||
| const correspondingMenuItem = correspondingMenuItemLink.parentNode; | ||
|
|
||
| correspondingMenuItem?.classList.toggle('ibexa-tabs__tab--error', hasGroupError); | ||
|
|
||
| if (correspondingMenuItemLink) { | ||
| const tabLinkId = correspondingMenuItemLink.id; | ||
| const popupMenuItem = popupMenu.querySelector(`[data-tab-link-id="${tabLinkId}"]`); | ||
|
|
||
| popupMenuItem?.classList.toggle('ibexa-popup-menu__item--error', hasGroupError); | ||
| } | ||
| } | ||
| }); | ||
| }; | ||
| const invalidObserver = new MutationObserver(classInvalidChangedCallback); | ||
|
|
||
| invalidObserver.observe(formNode, { | ||
| subtree: true, | ||
| attributes: true, | ||
| attributeFilter: ['class'], | ||
| attributeOldValue: true, | ||
| }); | ||
|
|
||
| if (popupMenu) { | ||
| const classInvalidHiddenChangedCallback = (mutationList) => { | ||
| mutationList.forEach(() => { | ||
| const popupMenuItems = popupMenu.querySelectorAll( | ||
| '.ibexa-popup-menu__item--error:not(.ibexa-popup-menu__item--hidden)', | ||
| ); | ||
|
|
||
| moreBtn.classList.toggle('ibexa-tabs__tab--error', popupMenuItems.length); | ||
| }); | ||
| }; | ||
| const invalidHiddenObserver = new MutationObserver(classInvalidHiddenChangedCallback); | ||
|
|
||
| invalidHiddenObserver.observe(popupMenu, { | ||
| subtree: true, | ||
| attributes: true, | ||
| attributeFilter: ['class'], | ||
| attributeOldValue: true, | ||
| }); | ||
| } | ||
| }); | ||
| })(window, window.document); |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.